com php-src: Return null on zpp failure in Array::exchangeArray(): ext/spl/spl_array.c ext/spl/tests/arrayObject_exchangeA rray_basic3.phpt
| From: | Nikita Popov | Date: | Wed, 15 Apr 2015 18:43:41 +0000 |
| Subject: | com php-src: Return null on zpp failure in Array::exchangeArray(): ext/spl/spl_array.c ext/spl/tests/arrayObject_exchangeA rray_basic3.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86313@lists.php.net to get a copy of this message | ||
Commit: eed18f0ee872c6ca685c5b84a86f5657c6b9d915
Author: Nikita Popov <nikic@php.net> Wed, 15 Apr 2015 20:43:41 +0200
Parents: e10be0d0fd6255f12140838cc1c3f724e9778125
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=eed18f0ee872c6ca685c5b84a86f5657c6b9d915
Log:
Return null on zpp failure in Array::exchangeArray()
Method was still returning a value despite zpp failing previously...
Changed paths:
M ext/spl/spl_array.c
M ext/spl/tests/arrayObject_exchangeArray_basic3.phpt
Diff:
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index cee3807..7639238 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 4045b7a...ed2b8e8 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"
}