5.2.5 - changes in the string parser

php.internals

Dagdamor

18 years ago
Hello. I am reporting about the changes that were made in the string parser in 5.2.5. From this version, sequences "\f" and "\v" are special and are parsed as FF and VT symbols. IMHO that doesn't make sense because the behavior was different in the older versions of PHP, and will affect many existing scripts. Those two symbols are also very rarely used and I don't think this feature will be very useful for the developers. I checked the documentation. It says that only "\n", "\r" and "\t" sequences (I count only alphanumeric ones) are special, there is nothing about \f or \v. The documentation clearly says that all other sequences are not special and the backslash becomes part of the string. It also says: "usually, there is no need to escape the backslash itself", in other words, escaping the backslash only when necessary is allowed and encouraged. I ask for rolling that change back because it's a serious BC break. Regards, Serge

Edward Z. Yang

18 years ago
Dagdamor wrote:
> I am reporting about the changes that were made in the string parser in 5.2.5. > From this version, sequences "\f" and "\v" are special and are parsed as FF > and VT symbols.
See: http://bugs.php.net/bug.php?id=42590 In my opinion, if you have stray backslashes in double-quotes you'd better escape them as \\.
-- Edward Z. Yang GnuPG: 0x869C48DA HTML Purifier <http://htmlpurifier.org> Anti-XSS Filter [[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]

Edward Z. Yang

18 years ago
Dagdamor wrote:
> I checked the documentation. It says that only "\n", "\r" and "\t" sequences > (I count only alphanumeric ones) are special, there is nothing about \f or \v. > The documentation clearly says that all other sequences are not special and > the backslash becomes part of the string. It also says: "usually, there is no > need to escape the backslash itself", in other words, escaping the backslash > only when necessary is allowed and encouraged.
The documentation probably should be fixed. Also, \f and \v have been documented; your mirror probably isn't up to date. See: http://cvs.php.net/viewvc.cgi/phpdoc/en/language/types.xml?r1=1.189&r2=1.190&diff_format=u
-- Edward Z. Yang GnuPG: 0x869C48DA HTML Purifier <http://htmlpurifier.org> Anti-XSS Filter [[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]

Hannes Magnusson

18 years ago
On Nov 24, 2007 4:27 AM, Edward Z. Yang <edwardzyang@thewritingpot.com> wrote:
> The documentation probably should be fixed. Also, \f and \v have been > documented; your mirror probably isn't up to date. See: > http://cvs.php.net/viewvc.cgi/phpdoc/en/language/types.xml?r1=1.189&r2=1.190&diff_format=u
Its not the mirror. Our build master is MIA, the only mirror that is up to date is http://docs.php.net which does 4builds a day (for all 17 translations). -Hannes