mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
fix #38624 (Strange warning when incrementing an object property and exception is thrown from __get method)
This commit is contained in:
parent
2321d27bc8
commit
dd9165d60a
2 changed files with 37 additions and 1 deletions
34
Zend/tests/bug38624.phpt
Normal file
34
Zend/tests/bug38624.phpt
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #38624 (Strange warning when incrementing an object property and exception is thrown from __get method)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class impl
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->counter++;
|
||||||
|
}
|
||||||
|
public function __set( $name, $value )
|
||||||
|
{
|
||||||
|
throw new Exception( "doesn't work" );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __get( $name )
|
||||||
|
{
|
||||||
|
throw new Exception( "doesn't work" );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$impl = new impl();
|
||||||
|
|
||||||
|
echo "Done\n";
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Fatal error: Uncaught exception 'Exception' with message 'doesn't work' in %s:%d
|
||||||
|
Stack trace:
|
||||||
|
#0 %s(%d): impl->__get('counter')
|
||||||
|
#1 %s(%d): impl->__construct()
|
||||||
|
#2 {main}
|
||||||
|
thrown in %s on line %d
|
|
@ -93,7 +93,9 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
|
||||||
if (!obj_ce) {
|
if (!obj_ce) {
|
||||||
obj_ce = object_pp ? Z_OBJCE_PP(object_pp) : NULL;
|
obj_ce = object_pp ? Z_OBJCE_PP(object_pp) : NULL;
|
||||||
}
|
}
|
||||||
zend_error(E_CORE_ERROR, "Couldn't execute method %v%s%s", obj_ce ? obj_ce->name : EMPTY_ZSTR, obj_ce ? "::" : "", function_name);
|
if (!EG(exception)) {
|
||||||
|
zend_error(E_CORE_ERROR, "Couldn't execute method %v%s%s", obj_ce ? obj_ce->name : EMPTY_ZSTR, obj_ce ? "::" : "", function_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!retval_ptr_ptr) {
|
if (!retval_ptr_ptr) {
|
||||||
if (retval) {
|
if (retval) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue