Re: [PATCH] Fix octal parsing (finally)
| From: | Stanislav Malyshev | Date: | Sat, 10 Jan 2015 23:55:59 +0000 |
| Subject: | Re: [PATCH] Fix octal parsing (finally) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80339@lists.php.net to get a copy of this message | ||
Hi!
> A longstanding PHP bug is that invalid octal digits simply terminate
> the literal and are
ignored, rather than generating a compile error. Thus, this is valid:
>
> $x = 0109; // same as 010, or 8
>
> I see no particular reason why this behaviour should be preserved.
> I’ve written a patch that would finally fix it, and avoid similar
> parsing issues in future (e.g. the resurgence of the hex addition
> bug), by erroring when strtol doesn’t reach the end of the literal.
I think it's a good idea. It is a BC break but I think it's a kind of
things that we can and should fix in PHP 7. Not sure if it needs an RFC
- technically it's still a break. I personally would just let it go as
is but if anybody objects I think then we should have RFC and a vote.
--
Stas Malyshev
smalyshev@gmail.com