php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #60082
Patch recursion-detection revision 2011-10-20 05:44 UTC by tony2001@php.net
Patch bug60082.phpt revision 2011-10-18 12:51 UTC by laruence@php.net
Patch bug60082.patch revision 2011-10-18 12:46 UTC by laruence@php.net

Patch bug60082.patch for SPL related Bug #60082

Patch version 2011-10-18 12:46 UTC

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

Developer: laruence@php.net

Index: branches/PHP_5_3/ext/spl/spl_array.c
===================================================================
--- branches/PHP_5_3/ext/spl/spl_array.c	(revision 318182)
+++ branches/PHP_5_3/ext/spl/spl_array.c	(working copy)
@@ -87,9 +87,17 @@
 		return spl_array_get_hash_table(other, check_std_props TSRMLS_CC);
 	} else if ((intern->ar_flags & ((check_std_props ? SPL_ARRAY_STD_PROP_LIST : 0) | SPL_ARRAY_IS_SELF)) != 0) {
 		return intern->std.properties;
-	} else {
-		return HASH_OF(intern->array);
+	} else if (Z_TYPE_P(intern->array) == IS_ARRAY){
+		return Z_ARRVAL_P(intern->array);
+	} else if (Z_TYPE_P(intern->array) == IS_OBJECT) {
+		if (intern == (spl_array_object*)zend_object_store_get_object(intern->array TSRMLS_CC)) {
+			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Array was modified outside object and made a recursive object");
+			return NULL;
+		}
+		return Z_OBJ_HT_P(intern->array)->get_properties(intern->array TSRMLS_CC);
 	}
+
+	return NULL;
 } /* }}} */
 
 static void spl_array_rewind(spl_array_object *intern TSRMLS_DC);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 13:01:30 2024 UTC