From 950ea89fb0dbf8d80d9392bd74d8e95d25b85de1 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 14 Sep 2020 12:15:24 +0200 Subject: [PATCH] Convert E_ERROR to Error exception in mysqli_result iterator The same condition uses Error exceptions in lots of other classes. --- ext/mysqli/mysqli_result_iterator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/mysqli/mysqli_result_iterator.c b/ext/mysqli/mysqli_result_iterator.c index 13889378161..7aec918bbd0 100644 --- a/ext/mysqli/mysqli_result_iterator.c +++ b/ext/mysqli/mysqli_result_iterator.c @@ -45,8 +45,10 @@ zend_object_iterator *php_mysqli_result_get_iterator(zend_class_entry *ce, zval php_mysqli_result_iterator *iterator; if (by_ref) { - zend_error(E_ERROR, "An iterator cannot be used with foreach by reference"); + zend_throw_error(NULL, "An iterator cannot be used with foreach by reference"); + return NULL; } + iterator = ecalloc(1, sizeof(php_mysqli_result_iterator)); zend_iterator_init(&iterator->intern);