Merge branch 'PHP-7.0'

This commit is contained in:
Nikita Popov 2016-04-12 14:44:43 +02:00
commit fea822fe1b
3 changed files with 33 additions and 6 deletions

View File

@ -0,0 +1,25 @@
--TEST--
Indirect modification of isref by-value return value not possible
--FILE--
<?php
class A {
public $b;
}
$arr = [];
$a = new A;
$a->b =& $arr;
(new ReflectionProperty('A', 'b'))->getValue($a)[] = 42;
var_dump($a);
?>
--EXPECT--
object(A)#1 (1) {
["b"]=>
&array(0) {
}
}

View File

@ -7436,11 +7436,12 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED)
if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
if (UNEXPECTED(Z_REFCOUNT_P(var_ptr) == 1)) {
ZVAL_UNREF(var_ptr);
} else if (!(Z_VAR_FLAGS_P(var_ptr) & IS_VAR_RET_REF)) {
Z_DELREF_P(var_ptr);
ZVAL_COPY(var_ptr, Z_REFVAL_P(var_ptr));
}
} else if (Z_COPYABLE_P(var_ptr) && Z_REFCOUNT_P(var_ptr) > 1) {
Z_DELREF_P(var_ptr);
ZVAL_DUP(EX_VAR(opline->op1.var), var_ptr);
}
ZEND_VM_NEXT_OPCODE();
}

View File

@ -21393,11 +21393,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEPARATE_SPEC_VAR_UNUSED_HANDL
if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
if (UNEXPECTED(Z_REFCOUNT_P(var_ptr) == 1)) {
ZVAL_UNREF(var_ptr);
} else if (!(Z_VAR_FLAGS_P(var_ptr) & IS_VAR_RET_REF)) {
Z_DELREF_P(var_ptr);
ZVAL_COPY(var_ptr, Z_REFVAL_P(var_ptr));
}
} else if (Z_COPYABLE_P(var_ptr) && Z_REFCOUNT_P(var_ptr) > 1) {
Z_DELREF_P(var_ptr);
ZVAL_DUP(EX_VAR(opline->op1.var), var_ptr);
}
ZEND_VM_NEXT_OPCODE();
}