Re: Strings, invalid escape sequences and parse errors

From: Date: Fri, 02 Oct 2015 13:53:53 +0000
Subject: Re: Strings, invalid escape sequences and parse errors
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-88642@lists.php.net to get a copy of this message
On Fri, Oct 2, 2015 at 4:18 AM, Peter Cowburn <petercowburn@gmail.com> wrote: > a) change all other "invalid" escape sequences to be a parse error [that > would mean "\m" would raise a parse error!] > > b) change \u{} to behave like any other escape sequence, by not raising a > parse error and instead keeping the literal characters > > or c) tell me to keep quiet and accept the oddball behaviour, having quirks > is The PHP Way after all. > Well, I think option (a) would break parsed strings containing regex: $subject = "there are words here"; $pattern = "/\w+/"; // problem $rc = preg_match_all($pattern, $subject); echo "Matches: \x1b[7m$rc\x1b[0m\n"; // not a problem Option (b) sounds reasonable, but there's probably A Solid Reason it was implemented that way, which if so leaves (c.ii): accepting the odd-ball behavior....

« previous php.internals (#88642) next »