From 0655abef1a88cfd3ffe430b93aadbd1023259914 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Fri, 5 Jun 2015 18:42:21 +0800 Subject: [PATCH] Improve the fix for bug #69756 --- NEWS | 2 ++ Zend/zend_hash.c | 2 +- Zend/zend_hash.h | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index ecd70bba9d..53cc6215a2 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,8 @@ . Added support for SEARCH WebDav method. (Mats Lindh) - Core: + . Fixed bug #69756 (Fatal error: Nesting level too deep - recursive dependency + ? with ===). (Dmitry, Laruence) . Fixed bug #69758 (Item added to array not being removed by array_pop/shift ). (Laruence) . Fixed bug #68475 (Add support for $callable() sytnax with 'Class::method'). diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index b8d3b1f389..5cd1b0bfeb 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -71,7 +71,7 @@ static void _zend_is_inconsistent(const HashTable *ht, const char *file, int lin #define HASH_PROTECT_RECURSION(ht) \ if ((ht)->u.flags & HASH_FLAG_APPLY_PROTECTION) { \ - if (((ht)->u.flags & 0xff00) >= (3 << 8)) { \ + if (((ht)->u.flags & ZEND_HASH_APPLY_COUNT_MASK) >= (3 << 8)) { \ zend_error_noreturn(E_ERROR, "Nesting level too deep - recursive dependency?");\ } \ ZEND_HASH_INC_APPLY_COUNT(ht); \ diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 78a04ce038..3ae3e4571b 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -845,8 +845,9 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, #define ZEND_HASH_APPLY_PROTECTION(ht) \ ((ht)->u.flags & HASH_FLAG_APPLY_PROTECTION) -#define ZEND_HASH_APPLY_SHIFT 8 -#define ZEND_HASH_GET_APPLY_COUNT(ht) ((ht)->u.flags >> ZEND_HASH_APPLY_SHIFT) +#define ZEND_HASH_APPLY_SHIFT 8 +#define ZEND_HASH_APPLY_COUNT_MASK 0xff00 +#define ZEND_HASH_GET_APPLY_COUNT(ht) (((ht)->u.flags & ZEND_HASH_APPLY_COUNT_MASK) >> ZEND_HASH_APPLY_SHIFT) #define ZEND_HASH_INC_APPLY_COUNT(ht) ((ht)->u.flags += (1 << ZEND_HASH_APPLY_SHIFT)) #define ZEND_HASH_DEC_APPLY_COUNT(ht) ((ht)->u.flags -= (1 << ZEND_HASH_APPLY_SHIFT)) -- 2.40.0