Edit report at https://bugs.php.net/bug.php?id=65339&edit=1
ID: 65339
Comment by: cmbecker69 at gmx dot de
Reported by: dondanielsgh at yahoo dot com
Summary: 08 and 8 are not the same and 09 and 9 are also not
the same
Status: Open
Type: Bug
Package: PHP options/info functions
Operating System: windows
PHP Version: 5.5.1
Block user comment: N
Private report: N
New Comment:
| the results should be correct.
Actually the results are correct. 07, 08 and 09 are treated as
octal integers, and the documentation on integers
(<http://www.php.net/manual/en/language.types.integer.php>) states:
| If an invalid digit is given in an octal integer (i.e. 8 or 9),
| the rest of the number is ignored.
Previous Comments:
------------------------------------------------------------------------
[2013-07-25 20:42:49] dondanielsgh at yahoo dot com
Description:
------------
$x = 07;
if($x == 7){
echo 'correct';
}else{
echo 'they are not the same';
}
$x = 08;
if($x == 8){
echo 'correct';
}else{
echo 'they are not the same';
}
$x = 09;
if($x == 9){
echo 'correct';
}else{
echo 'they are not the same';
}
Test script:
---------------
$x = 07;
if($x == 7){
echo 'correct';
}else{
echo 'they are not the same';
}
$x = 08;
if($x == 8){
echo 'correct';
}else{
echo 'they are not the same';
}
$x = 09;
if($x == 9){
echo 'correct';
}else{
echo 'they are not the same';
}
Expected result:
----------------
$x = 08;
if($x == 8){
echo 'correct';
}else{
echo 'they are not the same';
}
$x = 09;
if($x == 9){
echo 'correct';
}else{
echo 'they are not the same';
}
the results should be correct.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65339&edit=1