From:
Operating system: Windows Vista
PHP version: 5.3.10
Package: Variables related
Bug Type: Bug
Bug description:assigning 09 to variable
Description:
------------
My concern is that PHP treats the handling of variable assignment
inconsistently. For example if I assign 01 to a variable $i01 the result
will be an int 1, the same as if I had assigned 1 to the variable. This
works for values of 01,02,03,04,05,06, and 07. However 08 and 09 are
assigned as 0!
See repeatable test below.
Test script:
---------------
Assign variables:
$s09 = '09';
$c09 = (integer) '09';
$i09 = 09;
Result of var_dump($s09.' / '.$c09.' / '.$i09);
string '09 / 9 / 0'
Assign variables:
$s07 = '07';
$c07 = (integer) '07';
$i07 = 07;
Result of var_dump($s07.' / '.$c07.' / '.$i07);
string '07 / 7 / 7'
And when I just dump the $iXX variable I get:
var_dump($i09);
Result int 0
var_dump($i07);
Result int 7
This looks like a bug to me.
--
Edit bug report at https://bugs.php.net/bug.php?id=61293&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=61293&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=61293&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=61293&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=61293&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=61293&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=61293&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=61293&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=61293&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=61293&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=61293&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=61293&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=61293&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=61293&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=61293&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=61293&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61293&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=61293&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=61293&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=61293&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=61293&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=61293&r=mysqlcfg