Fixed bug #31341 (escape on curly inconsistent)

This commit is contained in:
Dmitry Stogov 2005-10-21 13:22:05 +00:00
parent af0adbed39
commit 187b6cc583
3 changed files with 37 additions and 3 deletions

1
NEWS
View File

@ -14,6 +14,7 @@ PHP NEWS
- Fixed bug #33829 (mime_content_type() returns text/plain for gzip and bzip
files). (Derick)
- Fixed bug #34623 (Crash in pdo_mysql on longtext fields). (Ilia)
- Fixed bug #31341 (escape on curly inconsistent). (Dmitry)
- Fixed bug #31177 (menory leaks and corruption because of incorrect
refcounting). (Dmitry)
- Fixed bug #29983 (PHP does not explicitly set mime type & charset). (Ilia)

29
Zend/tests/bug31341.phpt Executable file
View File

@ -0,0 +1,29 @@
--TEST--
Bug #31341 (escape on curly inconsistent)
--FILE--
<?php
$a = array(
"$ \{ ",
" \{ $",
" \{$ ",
" $\{ ",
" \$\{ ",
" \{\$ ",
"\$ \{ ",
" \{ \$",
"% \{ ");
foreach ($a as $v) {
echo("'$v'\n");
}
?>
--EXPECT--
'$ \{ '
' \{ $'
' {$ '
' $\{ '
' $\{ '
' \{$ '
'$ \{ '
' \{ $'
'% \{ '

View File

@ -1834,6 +1834,13 @@ NEWLINE ("\r"|"\n"|"\r\n")
return T_CHARACTER;
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\{$" {
zendlval->value.str.val = estrndup("{$", sizeof("{$")-1);
zendlval->value.str.len = sizeof("{$")-1;
zendlval->type = IS_STRING;
return T_STRING;
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"{ANY_CHAR} {
switch (yytext[1]) {
case 'n':
@ -1851,9 +1858,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
case '$':
zendlval->value.lval = (long) yytext[1];
break;
case '{':
zendlval->value.lval = (long) yytext[1];
break;
default:
zendlval->value.str.val = estrndup(yytext, yyleng);
zendlval->value.str.len = yyleng;