summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rwxr-xr-xext/spl/spl_array.c11
2 files changed, 12 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index f7f691f437..3318b784e1 100644
--- a/NEWS
+++ b/NEWS
@@ -175,6 +175,8 @@ PHP NEWS
com)
- SPL:
+ . Fixed bug #60082 (Crash in ArrayObject() when using recursive references).
+ (Tony)
. Fixed bug #55807 (Wrong value for splFileObject::SKIP_EMPTY).
(jgotti at modedemploi dot fr, Hannes)
. Fixed bug #54304 (RegexIterator::accept() doesn't work with scalar values).
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index a12d46297e..4f51e30c09 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -77,6 +77,7 @@ typedef struct _spl_array_object {
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,16 @@ SPL_METHOD(Array, getArrayCopy)
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) {
+ 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) /* {{{ */