dmitry                                   Tue, 28 Jul 2009 12:36:08 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=286453

Log:
Fixed bug #48912 (Namespace causes unexpected strict behaviour with extract())

Bug: http://bugs.php.net/48912 (Assigned) Namespace causes unexpected strict 
behaviour with extract()
      
Changed paths:
    A   php/php-src/trunk/Zend/tests/bug48912.phpt
    U   php/php-src/trunk/Zend/zend_vm_def.h
    U   php/php-src/trunk/Zend/zend_vm_execute.h

Added: php/php-src/trunk/Zend/tests/bug48912.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug48912.phpt                          (rev 0)
+++ php/php-src/trunk/Zend/tests/bug48912.phpt  2009-07-28 12:36:08 UTC (rev 
286453)
@@ -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

Modified: php/php-src/trunk/Zend/zend_vm_def.h
===================================================================
--- php/php-src/trunk/Zend/zend_vm_def.h        2009-07-28 12:35:27 UTC (rev 
286452)
+++ php/php-src/trunk/Zend/zend_vm_def.h        2009-07-28 12:36:08 UTC (rev 
286453)
@@ -2749,7 +2749,9 @@
        } 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);

Modified: php/php-src/trunk/Zend/zend_vm_execute.h
===================================================================
--- php/php-src/trunk/Zend/zend_vm_execute.h    2009-07-28 12:35:27 UTC (rev 
286452)
+++ php/php-src/trunk/Zend/zend_vm_execute.h    2009-07-28 12:36:08 UTC (rev 
286453)
@@ -24,9 +24,6 @@

 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 @@
        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 @@
        } 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 @@
        } 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_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;
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to