Bug #63705 [Opn->Nab]: lack of error message
Edit report at https://bugs.php.net/bug.php?id=63705&edit=1
ID: 63705
Updated by: rasmus@php.net
Reported by: iam4webwork at hotmail dot com
Summary: lack of error message
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Octals are by definition identified by a single leading 0, not 2.
Previous Comments:
------------------------------------------------------------------------
[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
Thread (4 messages)