com php-src: Convert SPL fatal error to Error exception: ext/spl/spl_iterators.c ext/spl/tests/bug41828 .phpt
| From: | Nikita Popov | Date: | Fri, 17 Jul 2020 14:06:54 +0000 |
| Subject: | com php-src: Convert SPL fatal error to Error exception: ext/spl/spl_iterators.c ext/spl/tests/bug41828 .phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-112217@lists.php.net to get a copy of this message | ||
Commit: 954244b3cb251c264a657ec5d39544f75a2c0cad
Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 17 Jul 2020 16:03:08 +0200
Parents: a1fee87c9a8a6ed58f2a8270c0a9e61a674d32db
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=954244b3cb251c264a657ec5d39544f75a2c0cad
Log:
Convert SPL fatal error to Error exception
Changed paths:
M ext/spl/spl_iterators.c
M ext/spl/tests/bug41828.phpt
Diff:
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==
-<?php exit(0); ?>
--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