com php-src: Promote warnings to errors in array_walk(_re cursive)(): ext/standard/array.c ext/standard/tes ts/array/bug70713.phpt

From: Date: Thu, 29 Aug 2019 14:02:59 +0000
Subject: com php-src: Promote warnings to errors in array_walk(_re cursive)(): ext/standard/array.c ext/standard/tes ts/array/bug70713.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-108132@lists.php.net to get a copy of this message
Commit: 62751b0d453ac51c559ea31d360a290081eb0c1d Author: George Peter Banyard <girgias@php.net> Wed, 21 Aug 2019 02:57:33 +0200 Committer: Joe Watkins <krakjoe@php.net> Thu, 29 Aug 2019 16:02:59 +0200 Parents: 81277a104c98476b0c427ac514cd307e75bc68da Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=62751b0d453ac51c559ea31d360a290081eb0c1d Log: Promote warnings to errors in array_walk(_recursive)() Changed paths: M ext/standard/array.c M ext/standard/tests/array/bug70713.phpt Diff: diff --git a/ext/standard/array.c b/ext/standard/array.c index 083d14e..245eeba 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1399,7 +1399,7 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */ SEPARATE_ARRAY(zv); thash = Z_ARRVAL_P(zv); if (GC_IS_RECURSIVE(thash)) { - php_error_docref(NULL, E_WARNING, "recursion detected"); + zend_throw_error(NULL, "Recursion detected"); result = FAILURE; break; } @@ -1450,7 +1450,7 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */ target_hash = Z_OBJPROP_P(array); pos = zend_hash_iterator_pos(ht_iter, target_hash); } else { - php_error_docref(NULL, E_WARNING, "Iterated value is no longer an array or object"); + zend_type_error("Iterated value is no longer an array or object"); result = FAILURE; break; } diff --git a/ext/standard/tests/array/bug70713.phpt b/ext/standard/tests/array/bug70713.phpt index 7cd0a0f..f247206 100644 --- a/ext/standard/tests/array/bug70713.phpt +++ b/ext/standard/tests/array/bug70713.phpt @@ -19,8 +19,13 @@ class obj } $arr = array('string' => new obj); -array_walk_recursive($arr, 'settype'); + +try { + array_walk_recursive($arr, 'settype'); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} ?> ---EXPECTF-- -Warning: array_walk_recursive(): Iterated value is no longer an array or object in %s on line %d +--EXPECT-- +Iterated value is no longer an array or object

« previous php.cvs (#108132) next »