dmitry                                   Wed, 13 Oct 2010 08:51:39 +0000

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

Log:
Fixed bug #52939 (zend_call_function does not respect ZEND_SEND_PREFER_REF)

Bug: http://bugs.php.net/52939 (Assigned) zend_call_function does not respect 
ZEND_SEND_PREFER_REF
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/Zend/tests/bug52939.phpt
    U   php/php-src/branches/PHP_5_3/Zend/zend_execute_API.c
    U   php/php-src/trunk/Zend/tests/bug52939.phpt
    U   php/php-src/trunk/Zend/zend_execute_API.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-10-13 05:12:12 UTC (rev 304363)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-10-13 08:51:39 UTC (rev 304364)
@@ -39,6 +39,8 @@
   in html_entity_decode that had introduced the bug (rev #185591) to other
   encodings. Additionaly, html_entity_decode() now doesn't decode " if
   ENT_NOQUOTES is given. (Gustavo)
+- Fixed bug #52939 (zend_call_function does not respect ZEND_SEND_PREFER_REF).
+  (Dmitry)
 - Fixed bug #52981 (Unicode casing table was out-of-date. Updated with
   UnicodeData-6.0.0d7.txt and included the source of the generator program with
   the distribution) (Gustavo).

Modified: php/php-src/branches/PHP_5_3/Zend/tests/bug52939.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug52939.phpt       2010-10-13 
05:12:12 UTC (rev 304363)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug52939.phpt       2010-10-13 
08:51:39 UTC (rev 304364)
@@ -10,6 +10,11 @@
 $args = array(&$ar1);
 var_dump(call_user_func_array("array_multisort", $args));
 var_dump($ar1);
+
+$ar1 = array("row1" => 2, "row2" => 1);
+$args = array($ar1);
+var_dump(call_user_func_array("array_multisort", $args));
+var_dump($ar1);
 ?>
 --EXPECT--
 bool(true)
@@ -26,3 +31,10 @@
   ["row1"]=>
   int(2)
 }
+bool(true)
+array(2) {
+  ["row1"]=>
+  int(2)
+  ["row2"]=>
+  int(1)
+}

Modified: php/php-src/branches/PHP_5_3/Zend/zend_execute_API.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_execute_API.c        2010-10-13 
05:12:12 UTC (rev 304363)
+++ php/php-src/branches/PHP_5_3/Zend/zend_execute_API.c        2010-10-13 
08:51:39 UTC (rev 304364)
@@ -870,7 +870,8 @@
                        if (Z_REFCOUNT_PP(fci->params[i]) > 1) {
                                zval *new_zval;

-                               if (fci->no_separation) {
+                               if (fci->no_separation &&
+                                   
!ARG_MAY_BE_SENT_BY_REF(EX(function_state).function, i + 1)) {
                                        if(i) {
                                                /* hack to clean up the stack */
                                                
zend_vm_stack_push_nocheck((void *) (zend_uintptr_t)i TSRMLS_CC);

Modified: php/php-src/trunk/Zend/tests/bug52939.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug52939.phpt  2010-10-13 05:12:12 UTC (rev 
304363)
+++ php/php-src/trunk/Zend/tests/bug52939.phpt  2010-10-13 08:51:39 UTC (rev 
304364)
@@ -10,6 +10,11 @@
 $args = array(&$ar1);
 var_dump(call_user_func_array("array_multisort", $args));
 var_dump($ar1);
+
+$ar1 = array("row1" => 2, "row2" => 1);
+$args = array($ar1);
+var_dump(call_user_func_array("array_multisort", $args));
+var_dump($ar1);
 ?>
 --EXPECT--
 bool(true)
@@ -26,3 +31,10 @@
   ["row1"]=>
   int(2)
 }
+bool(true)
+array(2) {
+  ["row1"]=>
+  int(2)
+  ["row2"]=>
+  int(1)
+}

Modified: php/php-src/trunk/Zend/zend_execute_API.c
===================================================================
--- php/php-src/trunk/Zend/zend_execute_API.c   2010-10-13 05:12:12 UTC (rev 
304363)
+++ php/php-src/trunk/Zend/zend_execute_API.c   2010-10-13 08:51:39 UTC (rev 
304364)
@@ -854,7 +854,8 @@
                        if (!PZVAL_IS_REF(*fci->params[i]) && 
Z_REFCOUNT_PP(fci->params[i]) > 1) {
                                zval *new_zval;

-                               if (fci->no_separation) {
+                               if (fci->no_separation &&
+                                   
!ARG_MAY_BE_SENT_BY_REF(EX(function_state).function, i + 1)) {
                                        if(i) {
                                                /* hack to clean up the stack */
                                                
zend_vm_stack_push_nocheck((void *) (zend_uintptr_t)i TSRMLS_CC);

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

Reply via email to