Merge branch 'PHP-7.1'

This commit is contained in:
Nikita Popov 2017-04-02 13:31:07 +02:00
commit 3a890180d3
2 changed files with 31 additions and 1 deletions

30
Zend/tests/bug74340.phpt Normal file
View File

@ -0,0 +1,30 @@
--TEST--
Bug #74340: Magic function __get has different behavior in php 7.1.x
--FILE--
<?php
class Test
{
public function __get($var)
{
static $first = true;
echo '__get '.$var.PHP_EOL;
if ($first) {
$first = false;
$this->$var;
$this->{$var.'2'};
$this->$var;
}
}
}
$test = new Test;
$test->test;
?>
--EXPECTF--
__get test
Notice: Undefined property: Test::$test in %s on line %d
__get test2
Notice: Undefined property: Test::$test in %s on line %d

View File

@ -533,7 +533,7 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
ALLOC_HASHTABLE(guards);
zend_hash_init(guards, 8, NULL, zend_property_guard_dtor, 0);
/* mark pointer as "special" using low bit */
zend_hash_add_new_ptr(guards, member,
zend_hash_add_new_ptr(guards, str,
(void*)(((zend_uintptr_t)&zv->u2.property_guard) | 1));
zend_string_release(Z_STR_P(zv));
ZVAL_ARR(zv, guards);