From f3272bf7acdd10ad0cea048c056d75ef39ce3f51 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 26 Mar 2014 22:52:28 +0400 Subject: [PATCH] Fixed extract() support IS_INDIRECT --- Zend/zend_hash.h | 10 ++++++++++ ext/standard/array.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index b9918304cd..41bb305c45 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -261,6 +261,16 @@ static inline zval *zend_hash_find_ind(const HashTable *ht, zend_string *key) } +static inline int *zend_hash_exists_ind(const HashTable *ht, zend_string *key) +{ + zval *zv; + + zv = zend_hash_find(ht, key); + return zv && (Z_TYPE_P(zv) != IS_INDIRECT || + Z_TYPE_P(Z_INDIRECT_P(zv)) != IS_UNDEF); +} + + static inline zval *zend_hash_str_find_ind(const HashTable *ht, const char *str, int len) { zval *zv; diff --git a/ext/standard/array.c b/ext/standard/array.c index e2a2f02332..b14fb2c577 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1359,7 +1359,7 @@ PHP_FUNCTION(extract) var_exists = 0; if (key_type == HASH_KEY_IS_STRING) { - var_exists = zend_hash_exists(&EG(active_symbol_table)->ht, var_name); + var_exists = zend_hash_exists_ind(&EG(active_symbol_table)->ht, var_name); } else if (key_type == HASH_KEY_IS_LONG && (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID)) { zval num; -- 2.50.1