Patch recursion-detection for SPL related Bug #60082
Patch version 2011-10-20 05:44 UTC
Return to Bug #60082 |
Download this patch
Patch Revisions:
Developer: tony2001@php.net
Index: ext/spl/spl_array.c
===================================================================
--- ext/spl/spl_array.c (revision 318241)
+++ ext/spl/spl_array.c (working copy)
@@ -77,6 +77,7 @@
php_serialize_data_t *serialize_data;
php_unserialize_data_t *unserialize_data;
HashTable *debug_info;
+ unsigned char nApplyCount;
} spl_array_object;
static inline HashTable *spl_array_get_hash_table(spl_array_object* intern, int check_std_props TSRMLS_DC) { /* {{{ */
@@ -728,8 +729,17 @@
static HashTable *spl_array_get_properties(zval *object TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
+ HashTable *result;
- return spl_array_get_hash_table(intern, 1 TSRMLS_CC);
+ if (intern->nApplyCount > 1) {
+ /* bail out */
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Nesting level too deep - recursive dependency?");
+ }
+
+ intern->nApplyCount++;
+ result = spl_array_get_hash_table(intern, 1 TSRMLS_CC);
+ intern->nApplyCount--;
+ return result;
} /* }}} */
static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* {{{ */
|