From eed18f0ee872c6ca685c5b84a86f5657c6b9d915 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 15 Apr 2015 20:43:41 +0200 Subject: [PATCH] Return null on zpp failure in Array::exchangeArray() Method was still returning a value despite zpp failing previously... --- ext/spl/spl_array.c | 2 +- ext/spl/tests/arrayObject_exchangeArray_basic3.phpt | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index cee380709a..76392381ef 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -1256,11 +1256,11 @@ SPL_METHOD(Array, exchangeArray) zval *object = getThis(), *array; spl_array_object *intern = Z_SPLARRAY_P(object); - RETVAL_ARR(zend_array_dup(spl_array_get_hash_table(intern, 0))); if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &array) == FAILURE) { return; } + RETVAL_ARR(zend_array_dup(spl_array_get_hash_table(intern, 0))); spl_array_set_array(object, intern, array, 0L, 1); } /* }}} */ diff --git a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt index 4045b7a946..ed2b8e89e1 100644 --- a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt +++ b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt @@ -98,9 +98,7 @@ object(C)#3 (2) { ["addedToOriginal"]=> string(17) "added To Original" } -array(2) { - ["pub1"]=> - string(7) "public1" +array(1) { ["addedToCopy"]=> string(13) "added To Copy" } -- 2.40.0