From: Nikita Popov Date: Fri, 17 Jul 2020 14:03:08 +0000 (+0200) Subject: Convert SPL fatal error to Error exception X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=954244b3cb251c264a657ec5d39544f75a2c0cad;p=php Convert SPL fatal error to Error exception --- diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index ca1a5457e2..047a72082d 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -862,7 +862,8 @@ static zend_function *spl_recursive_it_get_method(zend_object **zobject, zend_st zval *zobj; if (!object->iterators) { - php_error_docref(NULL, E_ERROR, "The %s instance wasn't initialized properly", ZSTR_VAL((*zobject)->ce->name)); + zend_throw_error(NULL, "The %s instance wasn't initialized properly", ZSTR_VAL((*zobject)->ce->name)); + return NULL; } zobj = &object->iterators[level].zobject; diff --git a/ext/spl/tests/bug41828.phpt b/ext/spl/tests/bug41828.phpt index 6053e0e446..548b3884fc 100644 --- a/ext/spl/tests/bug41828.phpt +++ b/ext/spl/tests/bug41828.phpt @@ -15,7 +15,8 @@ $foo = new foo("This is bar"); echo $foo->bar(); ?> -==DONE== - --EXPECTF-- -Fatal error: main(): The foo instance wasn't initialized properly in %s on line %d +Fatal error: Uncaught Error: The foo instance wasn't initialized properly in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d