Octal escape sequence overflow %s is greater than 377

Description

Octal escape is a notation for double quoted strings, where a backslash followed by 3 digits is replaced by the character with this ASCII number. These ASCII numbers have a limit of 0o377.

Between 0o377 and 0o777, numbers are valid octals, and not ASCII numbers, so the error message appears.

Beyond 0o777, the sequence is not a valid octal anymore, and PHP does not process it, nor emit an error message.

Example

<?php

$a = "\500";

?>

Solutions

  • Check the value in the octal sequence to be valid.

  • Add backslashes, to make the characters literals.