]> granicus.if.org Git - php/commitdiff
Fixed bug #48912 (Namespace causes unexpected strict behaviour with extract())
authorDmitry Stogov <dmitry@php.net>
Tue, 28 Jul 2009 12:36:08 +0000 (12:36 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 28 Jul 2009 12:36:08 +0000 (12:36 +0000)
Zend/tests/bug48912.phpt [new file with mode: 0644]
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

diff --git a/Zend/tests/bug48912.phpt b/Zend/tests/bug48912.phpt
new file mode 100644 (file)
index 0000000..dc021a2
--- /dev/null
@@ -0,0 +1,16 @@
+--TEST--
+Bug #48912 (Namespace causes unexpected strict behaviour with extract())
+--FILE--
+<?php
+namespace A;
+
+function test()
+{
+       extract(func_get_arg(0));
+}
+
+test(array('x' => 1));
+echo "ok\n";
+?>
+--EXPECT--
+ok
index e8c7a94e3099850a2916622f9c4cc617271f006d..6dd3a90c554f4e76d6ccb0a8f9b2a5ec5f71c3e9 100644 (file)
@@ -2749,7 +2749,9 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
        } else {
                zval *valptr;
 
-               if (!(opline->extended_value & ZEND_ARG_SEND_SILENT)) {
+               if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ?
+                       !(opline->extended_value & ZEND_ARG_SEND_SILENT) :
+                       !ARG_MAY_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) {
                        zend_error(E_STRICT, "Only variables should be passed by reference");
                }
                ALLOC_ZVAL(valptr);
index 18885002a20f2b825990ee0b352b7d0fe95b1e6c..9ccfc5049557c0fe3636f667c1fbc7a383ae9a32 100644 (file)
@@ -24,9 +24,6 @@ static zend_uchar zend_user_opcodes[256] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,1
 
 static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op);
 
-#ifdef PHP_WIN32
-#pragma warning (disable:4101)
-#endif
 
 #define ZEND_VM_CONTINUE()   return 0
 #define ZEND_VM_RETURN()     return 1
@@ -653,12 +650,12 @@ static int ZEND_FASTCALL  ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
        for (i=0; i<EX(op_array)->last_brk_cont; i++) {
                if (EX(op_array)->brk_cont_array[i].start < 0) {
                        continue;
-               } else if ((zend_uint)EX(op_array)->brk_cont_array[i].start > op_num) {
+               } else if (EX(op_array)->brk_cont_array[i].start > op_num) {
                        /* further blocks will not be relevant... */
                        break;
-               } else if (op_num < (zend_uint)EX(op_array)->brk_cont_array[i].brk) {
+               } else if (op_num < EX(op_array)->brk_cont_array[i].brk) {
                        if (!catched ||
-                           catch_op_num >= (zend_uint)EX(op_array)->brk_cont_array[i].brk) {
+                           catch_op_num >= EX(op_array)->brk_cont_array[i].brk) {
                                zend_op *brk_opline = &EX(op_array)->opcodes[EX(op_array)->brk_cont_array[i].brk];
 
                                switch (brk_opline->opcode) {
@@ -8573,7 +8570,9 @@ static int ZEND_FASTCALL  ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
        } else {
                zval *valptr;
 
-               if (!(opline->extended_value & ZEND_ARG_SEND_SILENT)) {
+               if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ?
+                       !(opline->extended_value & ZEND_ARG_SEND_SILENT) :
+                       !ARG_MAY_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) {
                        zend_error(E_STRICT, "Only variables should be passed by reference");
                }
                ALLOC_ZVAL(valptr);
@@ -23106,7 +23105,9 @@ static int ZEND_FASTCALL  ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
        } else {
                zval *valptr;
 
-               if (!(opline->extended_value & ZEND_ARG_SEND_SILENT)) {
+               if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ?
+                       !(opline->extended_value & ZEND_ARG_SEND_SILENT) :
+                       !ARG_MAY_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) {
                        zend_error(E_STRICT, "Only variables should be passed by reference");
                }
                ALLOC_ZVAL(valptr);
@@ -31297,7 +31298,6 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CV_HANDLER(ZEND_OP
 static int ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
        zend_error_noreturn(E_ERROR, "Invalid opcode %d/%d/%d.", EX(opline)->opcode, EX(opline)->op1.op_type, EX(opline)->op2.op_type);
-       return 0;
 }