Property handle read_property exception in fetch_property_address

Otherwise we leak (and corrupt uninitialized_zval).
This commit is contained in:
Nikita Popov 2020-08-26 16:10:29 +02:00
parent 8e2f219fad
commit 247105ae1a
2 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,23 @@
--TEST--
Exception thrown by __get() during =& assignment
--FILE--
<?php
class Test {
private $x;
public function &__get($name) {
throw new Exception("Foobar");
}
}
$test = new Test;
$y = 5;
try {
$test->x =& $y;
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Foobar

View file

@ -2872,6 +2872,10 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
}
return;
}
if (UNEXPECTED(EG(exception))) {
ZVAL_ERROR(result);
return;
}
} else if (UNEXPECTED(Z_ISERROR_P(ptr))) {
ZVAL_ERROR(result);
return;