summaryrefslogtreecommitdiff
path: root/Zend/zend_builtin_functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r--Zend/zend_builtin_functions.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index d779e8a5ee..91bca37a1b 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -609,9 +609,9 @@ ZEND_FUNCTION(each)
Z_ADDREF_P(entry);
/* add the key elements */
- switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_key_len, &num_key, 1, NULL)) {
+ switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_key_len, &num_key, 0, NULL)) {
case HASH_KEY_IS_STRING:
- add_get_index_stringl(return_value, 0, string_key, string_key_len-1, (void **) &inserted_pointer, 0);
+ add_get_index_stringl(return_value, 0, string_key, string_key_len-1, (void **) &inserted_pointer, !IS_INTERNED(string_key));
break;
case HASH_KEY_IS_LONG:
add_get_index_long(return_value, 0, num_key, (void **) &inserted_pointer);
@@ -950,7 +950,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
zval_update_constant(&prop_copy, 0 TSRMLS_CC);
}
- add_assoc_zval(return_value, key, prop_copy);
+ zend_hash_update(Z_ARRVAL_P(return_value), key, key_len, &prop_copy, sizeof(zval*), NULL);
}
}
/* }}} */
@@ -1020,7 +1020,14 @@ ZEND_FUNCTION(get_object_vars)
zend_unmangle_property_name_ex(key, key_len - 1, &class_name, &prop_name, (int*) &prop_len);
/* Not separating references */
Z_ADDREF_PP(value);
- add_assoc_zval_ex(return_value, prop_name, prop_len + 1, *value);
+ if (IS_INTERNED(key) && prop_name != key) {
+ /* we can't use substring of interned string as a new key */
+ char *tmp = estrndup(prop_name, prop_len);
+ add_assoc_zval_ex(return_value, tmp, prop_len + 1, *value);
+ efree(tmp);
+ } else {
+ add_assoc_zval_ex(return_value, prop_name, prop_len + 1, *value);
+ }
}
}
zend_hash_move_forward_ex(properties, &pos);
@@ -1476,6 +1483,7 @@ ZEND_FUNCTION(crash)
ZEND_FUNCTION(get_included_files)
{
char *entry;
+ uint entry_len;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -1483,8 +1491,8 @@ ZEND_FUNCTION(get_included_files)
array_init(return_value);
zend_hash_internal_pointer_reset(&EG(included_files));
- while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 1) == HASH_KEY_IS_STRING) {
- add_next_index_string(return_value, entry, 0);
+ while (zend_hash_get_current_key_ex(&EG(included_files), &entry, &entry_len, NULL, 0, NULL) == HASH_KEY_IS_STRING) {
+ add_next_index_stringl(return_value, entry, entry_len-1, !IS_INTERNED(entry));
zend_hash_move_forward(&EG(included_files));
}
}