]> granicus.if.org Git - php/commitdiff
Fixed extract() support IS_INDIRECT
authorDmitry Stogov <dmitry@zend.com>
Wed, 26 Mar 2014 18:52:28 +0000 (22:52 +0400)
committerDmitry Stogov <dmitry@zend.com>
Wed, 26 Mar 2014 18:52:28 +0000 (22:52 +0400)
Zend/zend_hash.h
ext/standard/array.c

index b9918304cdda4c88d8f788ce80a18df108cfa358..41bb305c455ee30935cc6e0bd78ba8eb75626b22 100644 (file)
@@ -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;
index e2a2f0233250c7a247825faf0f64c913f58a0e7d..b14fb2c577010e6cf670fe6d7cbb77a9332a714f 100644 (file)
@@ -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;