]> granicus.if.org Git - php/commitdiff
Fixed bug #31341 (escape on curly inconsistent)
authorDmitry Stogov <dmitry@php.net>
Fri, 21 Oct 2005 13:22:10 +0000 (13:22 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 21 Oct 2005 13:22:10 +0000 (13:22 +0000)
Zend/tests/bug31341.phpt [new file with mode: 0755]
Zend/zend_language_scanner.l

diff --git a/Zend/tests/bug31341.phpt b/Zend/tests/bug31341.phpt
new file mode 100755 (executable)
index 0000000..2f68006
--- /dev/null
@@ -0,0 +1,29 @@
+--TEST--
+Bug #31341 (escape on curly inconsistent)
+--FILE--
+<?php
+$a = array(
+       "$     \{    ",
+       "      \{   $",
+       "      \{$   ",
+       "      $\{   ",
+       "      \$\{  ",
+       "      \{\$  ",
+       "\$    \{    ",
+       "      \{  \$",
+       "%     \{    ");
+
+foreach ($a as $v) {
+       echo("'$v'\n");
+}
+?>
+--EXPECT--
+'$     \{    '
+'      \{   $'
+'      {$   '
+'      $\{   '
+'      $\{  '
+'      \{$  '
+'$    \{    '
+'      \{  $'
+'%     \{    '
index 093e9253d8a5967ae78f9961ec7548bbad94cb53..a63bfec83e567a80ff365327184cc56855afdcae 100644 (file)
@@ -2428,6 +2428,13 @@ NEWLINE ("\r"|"\n"|"\r\n")
 }
 
 
+<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':
@@ -2445,9 +2452,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
                case '$':
                        zendlval->value.lval = (long) yytext[1];
                        break;
-               case '{':
-                       zendlval->value.lval = (long) yytext[1];
-                       break;
                default:
                        if (!zend_copy_string_value(zendlval, yytext, yyleng, CG(literal_type) TSRMLS_CC)) {
                                return 0;