Re: ini-parsing, double quotes, windows in 5.3

From: Date: Fri, 05 Sep 2008 13:59:23 +0000
Subject: Re: ini-parsing, double quotes, windows in 5.3
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-40285@lists.php.net to get a copy of this message
On 05.09.2008 14:57, Stan Vassilev | FM wrote:
I read it. \D in the same string isn't a legal escaped combination and this is where the user will be warned.
Nope. This is perfectly legal, too. # php -r 'var_dump("\W\H\A\T?");' string(9) "\W\H\A\T?"
Hi, If you'll treat the INI parsing exactly as a string literal in PHP code, there's no much to be done. Your proposal is to keep a completely separate method for parsing (the current one), which also doesn't allow quote as a character (there's no way to escape it). My proposal is to have a proper subset of the PHP string literal parsing, with the additional feature of warning when a user has apparently used the slash in a way he may not have intended. You wouldn't really escape your path like this, would you: c:\Documents\\toby instead you'd go for: c:\\Documents\\toby --OR--- c:/Documents/toby Furthermore, parameters which specify pathnames can check for tabs (\t), newlines (\n, \r) and null (\0) and warn the user for a possible mistake, we don't have an actual scenario where a pathname contains tab or a newline, now do we. The upside of all this is: 1) consistent handling of PHP.ini, other INI-s, and PHP string literals 2) all those extra checks can be removed in PHP 6 or 7 after the changes "sink in" into the userbase and it becomes common knowledge that backslash needs to be escaped. Regards, Stan Vassilev

« previous php.internals (#40285) next »