From 3f5c80e8c27b3d74f60ef7ce1a6933c7752ef8e4 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 22 Feb 2016 13:04:19 +0100 Subject: [PATCH] Don't recurse into USE_OTHER checking STD_PROP_LIST If STD_PROP_LIST is explicitly disabled in the constructor, it should really be disabled. --- ext/spl/spl_array.c | 2 +- .../ArrayObject_std_props_no_recursion.phpt | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 ext/spl/tests/ArrayObject_std_props_no_recursion.phpt diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index df2c7d126a..333830ad9d 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -92,7 +92,7 @@ static inline HashTable *spl_array_get_hash_table(spl_array_object* intern, int return intern->std.properties; } else if (intern->ar_flags & SPL_ARRAY_USE_OTHER) { spl_array_object *other = Z_SPLARRAY_P(&intern->array); - return spl_array_get_hash_table(other, check_std_props); + return spl_array_get_hash_table(other, 0); } else { return HASH_OF(&intern->array); } diff --git a/ext/spl/tests/ArrayObject_std_props_no_recursion.phpt b/ext/spl/tests/ArrayObject_std_props_no_recursion.phpt new file mode 100644 index 0000000000..193e972530 --- /dev/null +++ b/ext/spl/tests/ArrayObject_std_props_no_recursion.phpt @@ -0,0 +1,28 @@ +--TEST-- +Don't recurse into USE_OTHER when checking for STD_PROP_LIST +--FILE-- +prop = 'a'; +$b = new ArrayObject($a, 0); +$b->prop = 'b'; +var_dump((array) $b); +$c = new ArrayObject($a); +$c->prop = 'c'; +var_dump((array) $c); + +?> +--EXPECT-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(1) { + ["prop"]=> + string(1) "c" +} -- 2.50.1