#26314 [Opn->Csd]: Decimal numbers starting with 0 always treated as octals, even when invalid
| From: | nlopess@php.net | Date: | Mon, 26 Jul 2004 11:06:00 +0000 |
| Subject: | #26314 [Opn->Csd]: Decimal numbers starting with 0 always treated as octals, even when invalid | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969362158@lists.php.net to get a copy of this message | ||
ID: 26314
Updated by: nlopess@php.net
Reported By: matteo at beccati dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Debian GNU/Linux 3.0
PHP Version: 4.3.4
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
fixed by Jakub Vrana.
Previous Comments:
------------------------------------------------------------------------
[2003-11-19 06:50:12] matteo at beccati dot com
[Changed category to "Documentation problem"]
OK, I understand...
Can I suggest adding a warning in the manual to let people know what
happens when the provided number is invalid? IMHO that isn't much clear
now.
P.S.
Sorry for reopening it by changing the summary... I didn't know you
already answered :)
------------------------------------------------------------------------
[2003-11-19 06:48:40] derick@php.net
Fixed status
------------------------------------------------------------------------
[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