From 187b6cc583cae370ab17f68e642b8272068a706c Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 21 Oct 2005 13:22:05 +0000 Subject: [PATCH] Fixed bug #31341 (escape on curly inconsistent) --- NEWS | 1 + Zend/tests/bug31341.phpt | 29 +++++++++++++++++++++++++++++ Zend/zend_language_scanner.l | 10 +++++++--- 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100755 Zend/tests/bug31341.phpt diff --git a/NEWS b/NEWS index 5b230dc1c85..5907a6d68f8 100644 --- a/NEWS +++ b/NEWS @@ -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) diff --git a/Zend/tests/bug31341.phpt b/Zend/tests/bug31341.phpt new file mode 100755 index 00000000000..2f68006a077 --- /dev/null +++ b/Zend/tests/bug31341.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #31341 (escape on curly inconsistent) +--FILE-- + +--EXPECT-- +'$ \{ ' +' \{ $' +' {$ ' +' $\{ ' +' $\{ ' +' \{$ ' +'$ \{ ' +' \{ $' +'% \{ ' diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 96c21ca6f0d..111af67fcf6 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -1834,6 +1834,13 @@ NEWLINE ("\r"|"\n"|"\r\n") return T_CHARACTER; } +"\\{$" { + zendlval->value.str.val = estrndup("{$", sizeof("{$")-1); + zendlval->value.str.len = sizeof("{$")-1; + zendlval->type = IS_STRING; + return T_STRING; +} + "\\"{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;