#26314 [Opn->Bgs]: Decimal numbers starting with 0 always treated as octals, even when invalid
| From: | derick@php.net | Date: | Wed, 19 Nov 2003 11:48:41 +0000 |
| Subject: | #26314 [Opn->Bgs]: Decimal numbers starting with 0 always treated as octals, even when invalid | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-50690@lists.php.net to get a copy of this message | ||
ID: 26314
Updated by: derick@php.net
Reported By: matteo at beccati dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Debian GNU/Linux 3.0
PHP Version: 4.3.4
New Comment:
Fixed status
Previous Comments:
------------------------------------------------------------------------
[2003-11-19 06:40:55] matteo at beccati dot com
Fixed summary...
------------------------------------------------------------------------
[2003-11-19 06:39:40] derick@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
This is exactly as it should be. If you prefix the 0 on a non-octal
number, PHP still treats it as an octal number as is described in the
manual.
------------------------------------------------------------------------
[2003-11-19 06:37:32] matteo at beccati dot com
Description:
------------
According to the manual, integers can be specified in the octal
notation preceding the number with a zero. Some lines below I can see
this regexp:
octal : 0[0-7]+
What I don't understand is why an invalid octal number preceded by a 0
is treated as an octal, having a value of 0.
I know that you'll probably answer that it's a feature and not a bug,
but I think that this behaviour should be highlighted in the manual :)
Also checked on PHP 4.1.2, 4.3.0 and 4.3.3
Reproduce code:
---------------
<?php
var_dump(07); // Correct
var_dump(010); // Correct
var_dump(08); // Wrong, 8 is not an octal number
?>
Expected result:
----------------
int(7)
int(8)
int(8)
Actual result:
--------------
int(7)
int(8)
int(0)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26314&edit=1