Re: [PATCH] Fix octal parsing (finally)
| From: | Xinchen Hui | Date: | Sun, 11 Jan 2015 03:26:19 +0000 |
| Subject: | Re: [PATCH] Fix octal parsing (finally) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80349@lists.php.net to get a copy of this message | ||
Hey:
On Sun, Jan 11, 2015 at 6:37 AM, Andrea Faulds <ajf@ajf.me> wrote:
> Hey internals,
>
> 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.
>
> The pull request is here:
> https://github.com/php/php-src/pull/987
>
> I think this would be an acceptable BC break for PHP 7.
Agree, IMO previously behavior actually is a bug...
thanks
>
> Thoughts?
> --
> Andrea Faulds
> http://ajf.me/
>
>
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Xinchen Hui
@Laruence
http://www.laruence.com/