mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Property handle read_property exception in fetch_property_address
Otherwise we leak (and corrupt uninitialized_zval).
This commit is contained in:
parent
8e2f219fad
commit
247105ae1a
2 changed files with 27 additions and 0 deletions
23
Zend/tests/exception_during_by_reference_magic_get.phpt
Normal file
23
Zend/tests/exception_during_by_reference_magic_get.phpt
Normal 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
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue