Skip to content

Commit f4173a8

Browse files
committed
Fixed bug #52939 (zend_call_function does not respect ZEND_SEND_PREFER_REF)
1 parent a1888f5 commit f4173a8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Zend/tests/bug52939.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ $ar1 = array("row1" => 2, "row2" => 1);
1010
$args = array(&$ar1);
1111
var_dump(call_user_func_array("array_multisort", $args));
1212
var_dump($ar1);
13+
14+
$ar1 = array("row1" => 2, "row2" => 1);
15+
$args = array($ar1);
16+
var_dump(call_user_func_array("array_multisort", $args));
17+
var_dump($ar1);
1318
?>
1419
--EXPECT--
1520
bool(true)
@@ -26,3 +31,10 @@ array(2) {
2631
["row1"]=>
2732
int(2)
2833
}
34+
bool(true)
35+
array(2) {
36+
["row1"]=>
37+
int(2)
38+
["row2"]=>
39+
int(1)
40+
}

Zend/zend_execute_API.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,8 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
854854
if (!PZVAL_IS_REF(*fci->params[i]) && Z_REFCOUNT_PP(fci->params[i]) > 1) {
855855
zval *new_zval;
856856

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

0 commit comments

Comments
 (0)