]> granicus.if.org Git - php/commitdiff
Fixed bug #43027 (Declare cause fatal error)
authorDmitry Stogov <dmitry@php.net>
Thu, 1 Nov 2007 11:59:15 +0000 (11:59 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 1 Nov 2007 11:59:15 +0000 (11:59 +0000)
Zend/tests/bug43027.phpt [new file with mode: 0755]
Zend/zend_compile.c

diff --git a/Zend/tests/bug43027.phpt b/Zend/tests/bug43027.phpt
new file mode 100755 (executable)
index 0000000..2cf2d1d
--- /dev/null
@@ -0,0 +1,10 @@
+--TEST--
+Bug #43027 (Declare cause fatal error)
+--FILE--
+<?php
+declare(ticks=1);
+namespace test;
+echo "ok\n";
+?>
+--EXPECT--
+ok
index 963f7c2d1e3980b5360a03089c65f0bad2d8783c..f8c956664fd0798fa977c7ad854aa04c0c8683ae 100644 (file)
@@ -4496,10 +4496,11 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) /* {{{ */
                 * want to tell them to put declare() at the top.
                 */
                if (CG(active_op_array)->last > 0) {
-                       /* ignore ZEND_EXT_STMT */
+                       /* ignore ZEND_EXT_STMT and ZEND_TICKS */
                        int num = CG(active_op_array)->last;
                        while (num > 0 &&
-                              CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT) {
+                              (CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT ||
+                               CG(active_op_array)->opcodes[num-1].opcode == ZEND_TICKS)) {
                                --num;
                        }
                        if (num > 0) {
@@ -5075,10 +5076,11 @@ void zend_do_namespace(znode *name TSRMLS_DC) /* {{{ */
        zstr lcname;
 
        if (CG(active_op_array)->last > 0) {
-               /* ignore ZEND_EXT_STMT */
+               /* ignore ZEND_EXT_STMT and ZEND_TICKS */
                int num = CG(active_op_array)->last;
                while (num > 0 &&
-                      CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT) {
+                      (CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT ||
+                       CG(active_op_array)->opcodes[num-1].opcode == ZEND_TICKS)) {
                        --num;
                }
                if (num > 0) {