Re: [PATCH] Fix octal parsing (finally)
| From: | Yasuo Ohgaki | Date: | Sun, 11 Jan 2015 01:52:23 +0000 |
| Subject: | Re: [PATCH] Fix octal parsing (finally) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80341@lists.php.net to get a copy of this message | ||
Hi all,
Nice fix, Andrea!
On Sun, Jan 11, 2015 at 8:55 AM, Stanislav Malyshev <smalyshev@gmail.com>
wrote:
> > 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.
Invalid literal should not be allowed. It's bug in script anyway and just a
simple bug fix
in engine. It should be ok for new major release w/o RFC as long as it's
mentioned in
UPGRADING clearly, IMHO.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net