Re: [RFC][VOTE] Binary String Deprecation
| From: | Nikita Popov | Date: | Thu, 16 Feb 2017 23:18:16 +0000 |
| Subject: | Re: [RFC][VOTE] Binary String Deprecation | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98318@lists.php.net to get a copy of this message | ||
On Thu, Feb 16, 2017 at 11:25 PM, Nicolas Grekas <
nicolas.grekas+php@gmail.com> wrote:
> Actually, there is a very nasty side effect to the "b" prefix: it
> complicates using the output from token_get_all. You have to be very
> experienced (i.e. have feel the pain really) to know about this rare edge
> case - yet it must be dealt with if you want a correct parser in userland.
> See e.g.
>
> https://github.com/symfony/symfony/blob/8f65fc7ec1418593d433e39abb71d3
> 959eb10a0b/src/Symfony/Component/HttpKernel/Kernel.php#L718
> in Symfony.
> It'd have been great if the future would've been freed from this edge case.
> Too bad it has been rejected.
>
I feel your pain... Dealing with binary string lexing is surprisingly
subtle. The linked code is a nice illustration, because it handles the
binary string case -- but only for b" and not B", which is also valid. I
had the same bug in PHP-Parser until recently :/
Nikita