php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65339 08 and 8 are not the same and 09 and 9 are also not the same
Submitted: 2013-07-25 20:42 UTC Modified: 2013-07-26 01:25 UTC
From: dondanielsgh at yahoo dot com Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 5.5.1 OS: windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dondanielsgh at yahoo dot com
New email:
PHP Version: OS:

 

 [2013-07-25 20:42 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-26 00:03 UTC] cmbecker69 at gmx dot de
| 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.
 [2013-07-26 01:25 UTC] felipe@php.net
-Status: Open +Status: Not a bug
 [2013-07-26 01:25 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC