php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64264
Patch bug64264.phpt revision 2013-02-23 12:08 UTC by laruence@php.net
Patch bug64264.patch revision 2013-02-23 12:08 UTC by laruence@php.net

Patch bug64264.patch for SPL related Bug #64264

Patch version 2013-02-23 12:08 UTC

Return to Bug #64264 | Download this patch
Patch Revisions:

Developer: laruence@php.net

diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index 1d18afd..da70c18 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@ -624,10 +624,21 @@ SPL_METHOD(SplFixedArray, toArray)
 	zend_hash_init(ret_ht, 0, NULL, ZVAL_PTR_DTOR, 0);
 	ALLOC_INIT_ZVAL(ret);
 	Z_TYPE_P(ret) = IS_ARRAY;
-	obj_ht = spl_fixedarray_object_get_properties(getThis() TSRMLS_CC);
-	zend_hash_copy(ret_ht, obj_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
 	Z_ARRVAL_P(ret) = ret_ht;
 
+	if (intern->array) {
+		int i = 0;
+		for (; i < intern->array->size; i++) {
+			if (intern->array->elements[i]) {
+				zend_hash_index_update(ret_ht, i, (void *)&intern->array->elements[i], sizeof(zval *), NULL);
+				Z_ADDREF_P(intern->array->elements[i]);
+			} else {
+				zend_hash_index_update(ret_ht, i, (void *)&EG(uninitialized_zval_ptr), sizeof(zval *), NULL);
+				Z_ADDREF_P(EG(uninitialized_zval_ptr));
+			}
+		}
+	}
+
 	RETURN_ZVAL(ret, 1, 1);
 }
 /* }}} */
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 06:02:13 2014 UTC