From bcefc31e4e85ac6b31ff329543d390140a5ce2c4 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 6 Jul 2021 10:52:08 +0200 Subject: [PATCH] Fix ArrayObject::exchangeArray() return type This method cannot return null. --- ext/spl/spl_array.c | 2 +- ext/spl/spl_array.stub.php | 2 +- ext/spl/spl_array_arginfo.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 76e9fbae2be..9c8f95ee784 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -1292,7 +1292,7 @@ PHP_METHOD(ArrayObject, exchangeArray) if (intern->nApplyCount > 0) { zend_throw_error(NULL, "Modification of ArrayObject during sorting is prohibited"); - return; + RETURN_THROWS(); } RETVAL_ARR(zend_array_dup(spl_array_get_hash_table(intern))); diff --git a/ext/spl/spl_array.stub.php b/ext/spl/spl_array.stub.php index 1567d107f2c..303565213a6 100644 --- a/ext/spl/spl_array.stub.php +++ b/ext/spl/spl_array.stub.php @@ -78,7 +78,7 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Count /** @return Iterator */ public function getIterator() {} - /** @return array|null */ + /** @return array */ public function exchangeArray(array|object $array) {} /** @return void */ diff --git a/ext/spl/spl_array_arginfo.h b/ext/spl/spl_array_arginfo.h index 860b2e363dd..46a828638e0 100644 --- a/ext/spl/spl_array_arginfo.h +++ b/ext/spl/spl_array_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: da85db1e5e985ddbefaf38598133e3cba46475f2 */ + * Stub hash: a4bc5ec5a95aae6bfa53988316cfa396f4f9fb92 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject___construct, 0, 0, 0) ZEND_ARG_TYPE_MASK(0, array, MAY_BE_ARRAY|MAY_BE_OBJECT, "[]")