Edit report at https://bugs.php.net/bug.php?id=63705&edit=1
ID: 63705 Comment by: ni...@php.net Reported by: iam4webwork at hotmail dot com Summary: lack of error message Status: Not a bug Type: Bug Package: *General Issues PHP Version: Irrelevant Block user comment: N Private report: N New Comment: @rasmus: I still think that we should throw a notice/warning (in the lexer?) when an invalid octal is provided. Or do we have odd BC reasons preventing us from doing so? Previous Comments: ------------------------------------------------------------------------ [2012-12-06 06:12:31] ras...@php.net Octals are by definition identified by a single leading 0, not 2. ------------------------------------------------------------------------ [2012-12-06 06:08:09] iam4webwork at hotmail dot com Description: ------------ PHP fails to display error messages consistently when user provides invalid octals. Test script: --------------- $octal = 00812; $another = 00934; var_dump( $octal, $another); $will_error = 01c; var_dump( $will_error ); The first two octals PHP accepts as valid input, and silently truncates each. It only displays an error message for 01c and mentions the 'c' being a problem. Why doesn't PHP consistently reject invalid octal values and display error messages? Expected result: ---------------- I expected error messages to result for each of the first two invalid octals. Instead PHP blindly accepted them while having each evaluate as zero. It only caught on to 01c being a bad octal value. Actual result: -------------- int 0 int 0 Parse error: syntax error, unexpected 'c' (T_STRING) in ... ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63705&edit=1