PHP :: Bug #31341 :: escape on curly inconsistent
| Bug #31341 | escape on curly inconsistent | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2004-12-30 02:57 UTC | Modified: | 2005-10-21 15:22 UTC |
|
||||||||||
| From: | nmuhayimana at semanticdesigns dot com | Assigned: | dmitry (profile) | |||||||||||
| Status: | Closed | Package: | Scripting Engine problem | |||||||||||
| PHP Version: | 5CVS, 4CVS (2005-08-25) | OS: | * | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2004-12-30 02:57 UTC] nmuhayimana at semanticdesigns dot com
Description:
------------
Php suppresses the backslash before left curly brace using
"action at distance", violating the "principle of least surprise".
Apparently the backslash is suppressed if there is any non-escaped dollar sign any where in the string.
Reproduce code:
---------------
<?php
echo ("$ \{ \n");
echo (" \{ $\n");
echo (" \{$ \n");
echo (" $\{ \n");
echo (" \$\{ \n");
echo (" \{\$ \n");
echo ("\$ \{ \n");
echo (" \{ \$\n");
echo ("% \{ \n");
?>
Expected result:
----------------
$ \{
\{ $
{$
$\{
$\{
\{$
$ \{
\{ $
% \{
Actual result:
--------------
$ {
{ $
{$
${
$\{
\{$
$ \{
\{ $
% \{
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2005-02-21 20:42 UTC] sniper@php.net
[2005-05-18 12:33 UTC] stas@php.net
I think there's an omission in ST_IN_SCRIPTING state backshlash handling (around line 1525 of lex file) - unlike ST_DOUBLE_QUOTES state, it does not convert \{ to {. I think they should be brought together, though I'm not sure which one should win - should \{ be left as is or translated to {?[2005-08-03 14:05 UTC] gopalv82 at yahoo dot com
All it needs is just one case '{': in the ST_IN_SCRIPTING state's quoted string handling ?.