summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2014-04-21 14:14:00 +0800
committerXinchen Hui <laruence@gmail.com>2014-04-21 14:14:00 +0800
commite48b9ad197b4ec6ac72e75538453cc350d0a41f4 (patch)
treef5ded37abc65e64e270b6f1ac264db9bc603f949
parentcf7e703813e065fec7a8a5caa7aff4b70d3455b8 (diff)
parent54d9ad53f4797733b41bf2c65bd2c2cb5a1938b6 (diff)
downloadphp-git-e48b9ad197b4ec6ac72e75538453cc350d0a41f4.tar.gz
Merge branch 'refactoring2' of github.com:zendtech/php into refactoring2
-rw-r--r--Zend/zend.c71
-rw-r--r--Zend/zend_API.c96
-rw-r--r--Zend/zend_API.h4
-rw-r--r--Zend/zend_builtin_functions.c99
-rw-r--r--Zend/zend_closures.c12
-rw-r--r--Zend/zend_compile.c48
-rw-r--r--Zend/zend_compile.h18
-rw-r--r--Zend/zend_constants.c14
-rw-r--r--Zend/zend_constants.h2
-rw-r--r--Zend/zend_execute.c53
-rw-r--r--Zend/zend_execute.h35
-rw-r--r--Zend/zend_execute_API.c24
-rw-r--r--Zend/zend_generators.c2
-rw-r--r--Zend/zend_hash.h79
-rw-r--r--Zend/zend_interfaces.c4
-rw-r--r--Zend/zend_list.c7
-rw-r--r--Zend/zend_object_handlers.c83
-rw-r--r--Zend/zend_object_handlers.h21
-rw-r--r--Zend/zend_objects.c18
-rw-r--r--Zend/zend_objects_API.c4
-rw-r--r--Zend/zend_opcode.c18
-rw-r--r--Zend/zend_types.h4
-rw-r--r--Zend/zend_vm_def.h381
-rw-r--r--Zend/zend_vm_execute.h1600
-rw-r--r--Zend/zend_vm_execute.skl2
-rw-r--r--Zend/zend_vm_gen.php4
-rw-r--r--ext/date/php_date.c30
-rw-r--r--ext/dom/dom_iterators.c10
-rw-r--r--ext/dom/node.c4
-rw-r--r--ext/dom/nodelist.c8
-rw-r--r--ext/dom/php_dom.c165
-rw-r--r--ext/dom/php_dom.h14
-rw-r--r--ext/dom/xpath.c45
-rw-r--r--ext/libxml/libxml.c15
-rw-r--r--ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt1
-rw-r--r--ext/opcache/Optimizer/block_pass.c18
-rw-r--r--ext/opcache/Optimizer/compact_literals.c38
-rw-r--r--ext/opcache/Optimizer/optimize_func_calls.c8
-rw-r--r--ext/opcache/Optimizer/pass1_5.c8
-rw-r--r--ext/opcache/Optimizer/zend_optimizer.c32
-rw-r--r--ext/opcache/ZendAccelerator.h4
-rw-r--r--ext/opcache/zend_accelerator_util_funcs.c1
-rw-r--r--ext/opcache/zend_persist.c8
-rw-r--r--ext/opcache/zend_persist_calc.c9
-rw-r--r--ext/pcre/php_pcre.c44
-rw-r--r--ext/reflection/php_reflection.c21
-rw-r--r--ext/simplexml/simplexml.c20
-rw-r--r--ext/spl/spl_array.c28
-rw-r--r--ext/spl/spl_directory.c2
-rw-r--r--ext/spl/spl_iterators.c4
-rw-r--r--ext/standard/array.c553
-rw-r--r--ext/standard/basic_functions.c25
-rw-r--r--ext/standard/file.c34
-rw-r--r--ext/standard/filters.c7
-rw-r--r--ext/standard/formatted_print.c6
-rw-r--r--ext/standard/http.c23
-rw-r--r--ext/standard/http_fopen_wrapper.c15
-rw-r--r--ext/standard/incomplete_class.c12
-rw-r--r--ext/standard/proc_open.c81
-rw-r--r--ext/standard/streamsfuncs.c82
-rw-r--r--ext/standard/string.c96
-rw-r--r--ext/standard/type.c12
-rw-r--r--ext/standard/url.c10
-rw-r--r--ext/standard/user_filters.c13
-rw-r--r--ext/standard/var.c46
-rw-r--r--sapi/phpdbg/phpdbg_info.c4
-rw-r--r--sapi/phpdbg/phpdbg_opcode.c4
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c4
68 files changed, 2074 insertions, 2193 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 57344547d5..cef24c085b 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -142,12 +142,10 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
}
ZEND_PUTS_EX("(\n");
indent += PRINT_ZVAL_INDENT;
- zend_hash_internal_pointer_reset_ex(ht, &iterator);
- while ((tmp = zend_hash_get_current_data_ex(ht, &iterator)) != NULL) {
+ ZEND_HASH_FOREACH_KEY_VAL(ht, num_key, string_key, tmp) {
if (Z_TYPE_P(tmp) == IS_INDIRECT) {
tmp = Z_INDIRECT_P(tmp);
if (Z_TYPE_P(tmp) == IS_UNDEF) {
- zend_hash_move_forward_ex(ht, &iterator);
continue;
}
}
@@ -155,40 +153,34 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
ZEND_PUTS_EX(" ");
}
ZEND_PUTS_EX("[");
- switch (zend_hash_get_current_key_ex(ht, &string_key, &num_key, 0, &iterator)) {
- case HASH_KEY_IS_STRING:
- if (is_object) {
- const char *prop_name, *class_name;
- int prop_len;
- int mangled = zend_unmangle_property_name_ex(string_key->val, string_key->len, &class_name, &prop_name, &prop_len);
-
- ZEND_WRITE_EX(prop_name, prop_len);
- if (class_name && mangled == SUCCESS) {
- if (class_name[0]=='*') {
- ZEND_PUTS_EX(":protected");
- } else {
- ZEND_PUTS_EX(":");
- ZEND_PUTS_EX(class_name);
- ZEND_PUTS_EX(":private");
- }
+ if (string_key) {
+ if (is_object) {
+ const char *prop_name, *class_name;
+ int prop_len;
+ int mangled = zend_unmangle_property_name_ex(string_key->val, string_key->len, &class_name, &prop_name, &prop_len);
+
+ ZEND_WRITE_EX(prop_name, prop_len);
+ if (class_name && mangled == SUCCESS) {
+ if (class_name[0]=='*') {
+ ZEND_PUTS_EX(":protected");
+ } else {
+ ZEND_PUTS_EX(":");
+ ZEND_PUTS_EX(class_name);
+ ZEND_PUTS_EX(":private");
}
- } else {
- ZEND_WRITE_EX(string_key->val, string_key->len);
}
- break;
- case HASH_KEY_IS_LONG:
- {
- char key[25];
- snprintf(key, sizeof(key), "%ld", num_key);
- ZEND_PUTS_EX(key);
- }
- break;
+ } else {
+ ZEND_WRITE_EX(string_key->val, string_key->len);
+ }
+ } else {
+ char key[25];
+ snprintf(key, sizeof(key), "%ld", num_key);
+ ZEND_PUTS_EX(key);
}
ZEND_PUTS_EX("] => ");
zend_print_zval_r_ex(write_func, tmp, indent+PRINT_ZVAL_INDENT TSRMLS_CC);
ZEND_PUTS_EX("\n");
- zend_hash_move_forward_ex(ht, &iterator);
- }
+ } ZEND_HASH_FOREACH_END();
indent -= PRINT_ZVAL_INDENT;
for (i = 0; i < indent; i++) {
ZEND_PUTS_EX(" ");
@@ -205,24 +197,19 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */
ulong num_key;
int i = 0;
- zend_hash_internal_pointer_reset_ex(ht, &iterator);
- while ((tmp = zend_hash_get_current_data_ex(ht, &iterator)) != NULL) {
+ ZEND_HASH_FOREACH_KEY_VAL(ht, num_key, string_key, tmp) {
if (i++ > 0) {
ZEND_PUTS(",");
}
ZEND_PUTS("[");
- switch (zend_hash_get_current_key_ex(ht, &string_key, &num_key, 0, &iterator)) {
- case HASH_KEY_IS_STRING:
- ZEND_WRITE(string_key->val, string_key->len);
- break;
- case HASH_KEY_IS_LONG:
- zend_printf("%ld", num_key);
- break;
+ if (string_key) {
+ ZEND_WRITE(string_key->val, string_key->len);
+ } else {
+ zend_printf("%ld", num_key);
}
ZEND_PUTS("] => ");
zend_print_flat_zval_r(tmp TSRMLS_CC);
- zend_hash_move_forward_ex(ht, &iterator);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index fc0b424200..7d79d99bee 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -1086,7 +1086,7 @@ static int zend_merge_property(zval *value TSRMLS_DC, int num_args, va_list args
zval member;
ZVAL_STR(&member, STR_COPY(hash_key->key));
- obj_ht->write_property(obj, &member, value, 0 TSRMLS_CC);
+ obj_ht->write_property(obj, &member, value, -1 TSRMLS_CC);
zval_ptr_dtor(&member);
}
return ZEND_HASH_APPLY_KEEP;
@@ -1119,13 +1119,10 @@ static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS
if ((*scope)->parent) {
zend_class_entry *ce = *scope;
- HashPosition pos;
zend_property_info *prop_info;
do {
- for (zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- (prop_info = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL;
- zend_hash_move_forward_ex(&ce->properties_info, &pos)) {
+ ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
if (is_static == ((prop_info->flags & ZEND_ACC_STATIC) != 0) &&
offset == prop_info->offset) {
int ret;
@@ -1135,7 +1132,7 @@ static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS
*scope = old_scope;
return ret;
}
- }
+ } ZEND_HASH_FOREACH_END();
ce = ce->parent;
} while (ce);
@@ -1223,17 +1220,12 @@ ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properti
{
object->properties = properties;
if (object->ce->default_properties_count) {
- HashPosition pos;
zval *prop, tmp;
zend_string *key;
ulong num_key;
zend_property_info *property_info;
- for (zend_hash_internal_pointer_reset_ex(properties, &pos);
- (prop = zend_hash_get_current_data_ex(properties, &pos)) != NULL &&
- zend_hash_get_current_key_ex(properties, &key, &num_key, 0, &pos) == HASH_KEY_IS_STRING;
- zend_hash_move_forward_ex(properties, &pos)) {
-
+ ZEND_HASH_FOREACH_KEY_VAL(properties, num_key, key, prop) {
ZVAL_STR(&tmp, key);
property_info = zend_get_property_info(object->ce, &tmp, 1 TSRMLS_CC);
if (property_info &&
@@ -1242,24 +1234,19 @@ ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properti
ZVAL_COPY_VALUE(&object->properties_table[property_info->offset], prop);
ZVAL_INDIRECT(prop, &object->properties_table[property_info->offset]);
}
- }
+ } ZEND_HASH_FOREACH_END();
}
}
/* }}} */
ZEND_API void object_properties_load(zend_object *object, HashTable *properties TSRMLS_DC) /* {{{ */
{
- HashPosition pos;
zval *prop, tmp;
zend_string *key;
ulong num_key;
zend_property_info *property_info;
- for (zend_hash_internal_pointer_reset_ex(properties, &pos);
- (prop = zend_hash_get_current_data_ex(properties, &pos)) != NULL &&
- zend_hash_get_current_key_ex(properties, &key, &num_key, 0, &pos) == HASH_KEY_IS_STRING;
- zend_hash_move_forward_ex(properties, &pos)) {
-
+ ZEND_HASH_FOREACH_KEY_VAL(properties, num_key, key, prop) {
ZVAL_STR(&tmp, key);
property_info = zend_get_property_info(object->ce, &tmp, 1 TSRMLS_CC);
if (property_info &&
@@ -1279,7 +1266,7 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties
prop = zend_hash_update(object->properties, key, prop);
zval_add_ref(prop);
}
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -1686,7 +1673,7 @@ ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long
ZVAL_LONG(&tmp, n);
ZVAL_STRINGL(&z_key, key, key_len);
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, -1 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1700,7 +1687,7 @@ ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int
ZVAL_BOOL(&tmp, b);
ZVAL_STRINGL(&z_key, key, key_len);
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, -1 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1714,7 +1701,7 @@ ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRML
ZVAL_NULL(&tmp);
ZVAL_STRINGL(&z_key, key, key_len);
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, -1 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1728,7 +1715,7 @@ ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len,
ZVAL_RES(&tmp, r);
ZVAL_STRINGL(&z_key, key, key_len);
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, -1 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1742,7 +1729,7 @@ ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, do
ZVAL_DOUBLE(&tmp, d);
ZVAL_STRINGL(&z_key, key, key_len);
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, -1 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1756,7 +1743,7 @@ ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, co
ZVAL_STRING(&tmp, str);
ZVAL_STRINGL(&z_key, key, key_len);
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, -1 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1770,7 +1757,7 @@ ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, c
ZVAL_STRINGL(&tmp, str, length);
ZVAL_STRINGL(&z_key, key, key_len);
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, -1 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1782,7 +1769,7 @@ ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval
zval z_key;
ZVAL_STRINGL(&z_key, key, key_len);
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, value, 0 TSRMLS_CC);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, value, -1 TSRMLS_CC);
zval_ptr_dtor(&z_key);
return SUCCESS;
}
@@ -1892,7 +1879,6 @@ try_again:
ZEND_API void zend_collect_module_handlers(TSRMLS_D) /* {{{ */
{
- HashPosition pos;
zend_module_entry *module;
int startup_count = 0;
int shutdown_count = 0;
@@ -1901,9 +1887,7 @@ ZEND_API void zend_collect_module_handlers(TSRMLS_D) /* {{{ */
int class_count = 0;
/* Collect extensions with request startup/shutdown handlers */
- for (zend_hash_internal_pointer_reset_ex(&module_registry, &pos);
- (module = zend_hash_get_current_data_ptr_ex(&module_registry, &pos)) != NULL;
- zend_hash_move_forward_ex(&module_registry, &pos)) {
+ ZEND_HASH_FOREACH_PTR(&module_registry, module) {
if (module->request_startup_func) {
startup_count++;
}
@@ -1913,7 +1897,7 @@ ZEND_API void zend_collect_module_handlers(TSRMLS_D) /* {{{ */
if (module->post_deactivate_func) {
post_deactivate_count++;
}
- }
+ } ZEND_HASH_FOREACH_END();
module_request_startup_handlers = (zend_module_entry**)malloc(
sizeof(zend_module_entry*) *
(startup_count + 1 +
@@ -1926,9 +1910,7 @@ ZEND_API void zend_collect_module_handlers(TSRMLS_D) /* {{{ */
module_post_deactivate_handlers[post_deactivate_count] = NULL;
startup_count = 0;
- for (zend_hash_internal_pointer_reset_ex(&module_registry, &pos);
- (module = zend_hash_get_current_data_ptr_ex(&module_registry, &pos)) != NULL;
- zend_hash_move_forward_ex(&module_registry, &pos)) {
+ ZEND_HASH_FOREACH_PTR(&module_registry, module) {
if (module->request_startup_func) {
module_request_startup_handlers[startup_count++] = module;
}
@@ -1938,17 +1920,15 @@ ZEND_API void zend_collect_module_handlers(TSRMLS_D) /* {{{ */
if (module->post_deactivate_func) {
module_post_deactivate_handlers[--post_deactivate_count] = module;
}
- }
+ } ZEND_HASH_FOREACH_END();
/* Collect internal classes with static members */
- for (zend_hash_internal_pointer_reset_ex(CG(class_table), &pos);
- (ce = zend_hash_get_current_data_ptr_ex(CG(class_table), &pos)) != NULL;
- zend_hash_move_forward_ex(CG(class_table), &pos)) {
+ ZEND_HASH_FOREACH_PTR(CG(class_table), ce) {
if (ce->type == ZEND_INTERNAL_CLASS &&
ce->default_static_members_count > 0) {
class_count++;
}
- }
+ } ZEND_HASH_FOREACH_END();
class_cleanup_handlers = (zend_class_entry**)malloc(
sizeof(zend_class_entry*) *
@@ -1956,14 +1936,12 @@ ZEND_API void zend_collect_module_handlers(TSRMLS_D) /* {{{ */
class_cleanup_handlers[class_count] = NULL;
if (class_count) {
- for (zend_hash_internal_pointer_reset_ex(CG(class_table), &pos);
- (ce = zend_hash_get_current_data_ptr_ex(CG(class_table), &pos)) != NULL;
- zend_hash_move_forward_ex(CG(class_table), &pos)) {
+ ZEND_HASH_FOREACH_PTR(CG(class_table), ce) {
if (ce->type == ZEND_INTERNAL_CLASS &&
ce->default_static_members_count > 0) {
class_cleanup_handlers[--class_count] = ce;
}
- }
+ } ZEND_HASH_FOREACH_END();
}
}
/* }}} */
@@ -3407,7 +3385,6 @@ ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count
ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC) /* {{{ */
{
- HashPosition pos;
zval *arg, *params;
zend_fcall_info_args_clear(fci, !args);
@@ -3423,12 +3400,10 @@ ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC) /*
fci->param_count = zend_hash_num_elements(Z_ARRVAL_P(args));
fci->params = params = (zval *) erealloc(fci->params, fci->param_count * sizeof(zval));
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(args), &pos);
- while ((arg = zend_hash_get_current_data_ex(Z_ARRVAL_P(args), &pos)) != NULL) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(args), arg) {
ZVAL_COPY(params, arg);
params++;
- zend_hash_move_forward_ex(Z_ARRVAL_P(args), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
return SUCCESS;
}
@@ -3737,7 +3712,7 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const
zend_error(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, class_name->val);
}
ZVAL_STRINGL(&property, name, name_length);
- Z_OBJ_HT_P(object)->write_property(object, &property, value, 0 TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, &property, value, -1 TSRMLS_CC);
zval_ptr_dtor(&property);
EG(scope) = old_scope;
@@ -3816,7 +3791,7 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *na
zend_string *key = STR_INIT(name, name_length, 0);
EG(scope) = scope;
- property = zend_std_get_static_property(scope, key, 0, NULL TSRMLS_CC);
+ property = zend_std_get_static_property(scope, key, 0, -1 TSRMLS_CC);
EG(scope) = old_scope;
STR_FREE(key);
if (!property) {
@@ -3916,7 +3891,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c
}
ZVAL_STRINGL(&property, name, name_length);
- value = Z_OBJ_HT_P(object)->read_property(object, &property, silent?BP_VAR_IS:BP_VAR_R, 0, &rv TSRMLS_CC);
+ value = Z_OBJ_HT_P(object)->read_property(object, &property, silent?BP_VAR_IS:BP_VAR_R, -1, &rv TSRMLS_CC);
zval_ptr_dtor(&property);
EG(scope) = old_scope;
@@ -3931,7 +3906,7 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *na
zend_string *key = STR_INIT(name, name_length, 0);
EG(scope) = scope;
- property = zend_std_get_static_property(scope, key, silent, NULL TSRMLS_CC);
+ property = zend_std_get_static_property(scope, key, silent, -1 TSRMLS_CC);
EG(scope) = old_scope;
STR_FREE(key);
@@ -4026,6 +4001,8 @@ ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_functi
zend_function *func;
HashPosition iterator;
HashTable *function_table;
+ zend_string *name;
+ ulong idx;
if (f->common.type != ZEND_USER_FUNCTION ||
*(f->op_array.refcount) < 2 ||
@@ -4035,13 +4012,9 @@ ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_functi
}
function_table = &ce->function_table;
- zend_hash_internal_pointer_reset_ex(function_table, &iterator);
- while ((func = zend_hash_get_current_data_ptr_ex(function_table, &iterator)) != NULL) {
+ ZEND_HASH_FOREACH_KEY_PTR(function_table, idx, name, func) {
if (func == f) {
- zend_string *name;
- ulong idx;
-
- if (zend_hash_get_current_key_ex(function_table, &name, &idx, 0, &iterator) != HASH_KEY_IS_STRING) {
+ if (!name) {
return f->common.function_name;
}
if (name->len == f->common.function_name->len &&
@@ -4050,8 +4023,7 @@ ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_functi
}
return zend_find_alias_name(f->common.scope, name);
}
- zend_hash_move_forward_ex(function_table, &iterator);
- }
+ } ZEND_HASH_FOREACH_END();
return f->common.function_name;
}
/* }}} */
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 6295d8a890..43c205c659 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -520,8 +520,8 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_lengt
ZEND_API int zend_delete_global_variable(zend_string *name TSRMLS_DC);
ZEND_API void zend_rebuild_symbol_table(TSRMLS_D);
-ZEND_API void zend_attach_symbol_table(TSRMLS_D);
-ZEND_API void zend_detach_symbol_table(TSRMLS_D);
+ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data);
+ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data);
ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS_DC);
ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int force TSRMLS_DC);
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index aebcb7436c..182c34f9ab 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -903,16 +903,12 @@ ZEND_FUNCTION(is_a)
/* {{{ add_class_vars */
static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value TSRMLS_DC)
{
- HashPosition pos;
zend_property_info *prop_info;
zval *prop, prop_copy;
zend_string *key;
ulong num_index;
- zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- while ((prop_info = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL) {
- zend_hash_get_current_key_ex(&ce->properties_info, &key, &num_index, 0, &pos);
- zend_hash_move_forward_ex(&ce->properties_info, &pos);
+ ZEND_HASH_FOREACH_KEY_PTR(&ce->properties_info, num_index, key, prop_info) {
if (((prop_info->flags & ZEND_ACC_SHADOW) &&
prop_info->ce != EG(scope)) ||
((prop_info->flags & ZEND_ACC_PROTECTED) &&
@@ -944,7 +940,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
}
zend_hash_update(Z_ARRVAL_P(return_value), key, &prop_copy);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -980,7 +976,6 @@ ZEND_FUNCTION(get_object_vars)
zval *obj;
zval *value;
HashTable *properties;
- HashPosition pos;
zend_string *key;
const char *prop_name, *class_name;
uint prop_len;
@@ -1005,17 +1000,8 @@ ZEND_FUNCTION(get_object_vars)
array_init(return_value);
- zend_hash_internal_pointer_reset_ex(properties, &pos);
-
- while ((value = zend_hash_get_current_data_ex(properties, &pos)) != NULL) {
- if (Z_TYPE_P(value) == IS_INDIRECT) {
- value = Z_INDIRECT_P(value);
- if (Z_TYPE_P(value) == IS_UNDEF) {
- zend_hash_move_forward_ex(properties, &pos);
- continue;
- }
- }
- if (zend_hash_get_current_key_ex(properties, &key, &num_index, 0, &pos) == HASH_KEY_IS_STRING) {
+ ZEND_HASH_FOREACH_KEY_VAL_IND(properties, num_index, key, value) {
+ if (key) {
if (zend_check_property_access(zobj, key TSRMLS_CC) == SUCCESS) {
/* Not separating references */
if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
@@ -1027,8 +1013,7 @@ ZEND_FUNCTION(get_object_vars)
}
}
}
- zend_hash_move_forward_ex(properties, &pos);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -1047,8 +1032,9 @@ ZEND_FUNCTION(get_class_methods)
zval *klass;
zval method_name;
zend_class_entry *ce = NULL;
- HashPosition pos;
zend_function *mptr;
+ zend_string *key;
+ ulong num_index;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &klass) == FAILURE) {
return;
@@ -1069,22 +1055,21 @@ ZEND_FUNCTION(get_class_methods)
}
array_init(return_value);
- zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);
- while ((mptr = zend_hash_get_current_data_ptr_ex(&ce->function_table, &pos)) != NULL) {
+ ZEND_HASH_FOREACH_KEY_PTR(&ce->function_table, num_index, key, mptr) {
+
if ((mptr->common.fn_flags & ZEND_ACC_PUBLIC)
|| (EG(scope) &&
(((mptr->common.fn_flags & ZEND_ACC_PROTECTED) &&
zend_check_protected(mptr->common.scope, EG(scope)))
|| ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) &&
EG(scope) == mptr->common.scope)))) {
- zend_string *key;
- ulong num_index;
uint len = mptr->common.function_name->len;
/* Do not display old-style inherited constructors */
- if (zend_hash_get_current_key_ex(&ce->function_table, &key, &num_index, 0, &pos) != HASH_KEY_IS_STRING) {
- ZVAL_STR(&method_name, STR_COPY(mptr->common.function_name));
+ if (!key) {
+// TODO: we have to duplicate it, becaise it may be stored in opcache SHM ???
+ ZVAL_STR(&method_name, STR_DUP(mptr->common.function_name, 0));
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &method_name);
} else if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 ||
mptr->common.scope == ce ||
@@ -1097,13 +1082,13 @@ ZEND_FUNCTION(get_class_methods)
ZVAL_STR(&method_name, STR_COPY(zend_find_alias_name(mptr->common.scope, key)));
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &method_name);
} else {
- ZVAL_STR(&method_name, STR_COPY(mptr->common.function_name));
+// TODO: we have to duplicate it, becaise it may be stored in opcache SHM ???
+ ZVAL_STR(&method_name, STR_DUP(mptr->common.function_name, 0));
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &method_name);
}
}
}
- zend_hash_move_forward_ex(&ce->function_table, &pos);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -1203,7 +1188,7 @@ ZEND_FUNCTION(property_exists)
if (Z_TYPE_P(object) == IS_OBJECT &&
Z_OBJ_HANDLER_P(object, has_property) &&
- Z_OBJ_HANDLER_P(object, has_property)(object, &property_z, 2, 0 TSRMLS_CC)) {
+ Z_OBJ_HANDLER_P(object, has_property)(object, &property_z, 2, -1 TSRMLS_CC)) {
RETURN_TRUE;
}
RETURN_FALSE;
@@ -1441,17 +1426,18 @@ ZEND_FUNCTION(crash)
ZEND_FUNCTION(get_included_files)
{
zend_string *entry;
+ ulong num_idx;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
array_init(return_value);
- zend_hash_internal_pointer_reset(&EG(included_files));
- while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 0) == HASH_KEY_IS_STRING) {
- add_next_index_str(return_value, STR_COPY(entry));
- zend_hash_move_forward(&EG(included_files));
- }
+ ZEND_HASH_FOREACH_KEY(&EG(included_files), num_idx, entry) {
+ if (entry) {
+ add_next_index_str(return_value, STR_COPY(entry));
+ }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -1926,7 +1912,6 @@ ZEND_FUNCTION(get_defined_constants)
array_init(return_value);
if (categorize) {
- HashPosition pos;
zend_constant *val;
int module_number;
zval *modules;
@@ -1938,28 +1923,25 @@ ZEND_FUNCTION(get_defined_constants)
module_names = emalloc((zend_hash_num_elements(&module_registry) + 2) * sizeof(char *));
module_names[0] = "internal";
- zend_hash_internal_pointer_reset_ex(&module_registry, &pos);
- while ((module = zend_hash_get_current_data_ptr_ex(&module_registry, &pos)) != NULL) {
+ ZEND_HASH_FOREACH_PTR(&module_registry, module) {
module_names[module->module_number] = (char *)module->name;
i++;
- zend_hash_move_forward_ex(&module_registry, &pos);
- }
+ } ZEND_HASH_FOREACH_END();
module_names[i] = "user";
- zend_hash_internal_pointer_reset_ex(EG(zend_constants), &pos);
- while ((val = zend_hash_get_current_data_ptr_ex(EG(zend_constants), &pos)) != NULL) {
+ ZEND_HASH_FOREACH_PTR(EG(zend_constants), val) {
zval const_val;
if (!val->name) {
/* skip special constants */
- goto next_constant;
+ continue;
}
if (val->module_number == PHP_USER_CONSTANT) {
module_number = i;
} else if (val->module_number > i || val->module_number < 0) {
/* should not happen */
- goto next_constant;
+ continue;
} else {
module_number = val->module_number;
}
@@ -1972,9 +1954,8 @@ ZEND_FUNCTION(get_defined_constants)
ZVAL_DUP_DEREF(&const_val, &val->value);
zend_hash_update(Z_ARRVAL(modules[module_number]), val->name, &const_val);
-next_constant:
- zend_hash_move_forward_ex(EG(zend_constants), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
+
efree(module_names);
efree(modules);
} else {
@@ -2007,17 +1988,14 @@ static void debug_backtrace_get_args(zval *curpos, zval *arg_array TSRMLS_DC)
void debug_print_backtrace_args(zval *arg_array TSRMLS_DC)
{
zval *tmp;
- HashPosition iterator;
int i = 0;
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arg_array), &iterator);
- while ((tmp = zend_hash_get_current_data_ex(Z_ARRVAL_P(arg_array), &iterator)) != NULL) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(arg_array), tmp) {
if (i++) {
ZEND_PUTS(", ");
}
zend_print_flat_zval_r(tmp TSRMLS_CC);
- zend_hash_move_forward_ex(Z_ARRVAL_P(arg_array), &iterator);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* {{{ proto void debug_print_backtrace([int options[, int limit]]) */
@@ -2240,7 +2218,8 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
break;
}
if (prev->op_array) {
- add_assoc_str_ex(&stack_frame, "file", sizeof("file")-1, STR_COPY(prev->op_array->filename));
+// TODO: we have to duplicate it, becaise it may be stored in opcache SHM ???
+ add_assoc_str_ex(&stack_frame, "file", sizeof("file")-1, STR_DUP(prev->op_array->filename, 0));
add_assoc_long_ex(&stack_frame, "line", sizeof("line")-1, prev->opline->lineno);
break;
}
@@ -2399,8 +2378,8 @@ ZEND_FUNCTION(get_extension_funcs)
zend_string *lcname;
int extension_name_len, array;
zend_module_entry *module;
- HashPosition iterator;
zend_function *zif;
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) {
return;
}
@@ -2416,7 +2395,6 @@ ZEND_FUNCTION(get_extension_funcs)
RETURN_FALSE;
}
- zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator);
if (module->functions) {
/* avoid BC break, if functions list is empty, will return an empty array */
array_init(return_value);
@@ -2424,17 +2402,18 @@ ZEND_FUNCTION(get_extension_funcs)
} else {
array = 0;
}
- while ((zif = zend_hash_get_current_data_ptr_ex(CG(function_table), &iterator)) != NULL) {
+
+ ZEND_HASH_FOREACH_PTR(CG(function_table), zif) {
if (zif->common.type == ZEND_INTERNAL_FUNCTION
&& zif->internal_function.module == module) {
if (!array) {
array_init(return_value);
array = 1;
}
- add_next_index_str(return_value, STR_COPY(zif->common.function_name));
+// TODO: we have to duplicate it, becaise it may be stored in opcache SHM ???
+ add_next_index_str(return_value, STR_DUP(zif->common.function_name, 0));
}
- zend_hash_move_forward_ex(CG(function_table), &iterator);
- }
+ } ZEND_HASH_FOREACH_END();
if (!array) {
RETURN_FALSE;
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index 1b1d6ef6ed..7b587a9223 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -152,7 +152,7 @@ ZEND_API zval* zend_get_closure_this_ptr(zval *obj TSRMLS_DC) /* {{{ */
}
/* }}} */
-static zend_function *zend_closure_get_method(zend_object **object, zend_string *method, const zend_literal *key TSRMLS_DC) /* {{{ */
+static zend_function *zend_closure_get_method(zend_object **object, zend_string *method, const zval *key TSRMLS_DC) /* {{{ */
{
zend_string *lc_name;
@@ -169,27 +169,27 @@ static zend_function *zend_closure_get_method(zend_object **object, zend_string
}
/* }}} */
-static zval *zend_closure_read_property(zval *object, zval *member, int type, const zend_literal *key, zval *rv TSRMLS_DC) /* {{{ */
+static zval *zend_closure_read_property(zval *object, zval *member, int type, zend_uint cache_slot, zval *rv TSRMLS_DC) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return &EG(uninitialized_zval);
}
/* }}} */
-static void zend_closure_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) /* {{{ */
+static void zend_closure_write_property(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
}
/* }}} */
-static zval *zend_closure_get_property_ptr_ptr(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */
+static zval *zend_closure_get_property_ptr_ptr(zval *object, zval *member, int type, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return NULL;
}
/* }}} */
-static int zend_closure_has_property(zval *object, zval *member, int has_set_exists, const zend_literal *key TSRMLS_DC) /* {{{ */
+static int zend_closure_has_property(zval *object, zval *member, int has_set_exists, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
if (has_set_exists != 2) {
ZEND_CLOSURE_PROPERTY_ERROR();
@@ -198,7 +198,7 @@ static int zend_closure_has_property(zval *object, zval *member, int has_set_exi
}
/* }}} */
-static void zend_closure_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) /* {{{ */
+static void zend_closure_unset_property(zval *object, zval *member, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
}
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 20a4a78c39..14d937bb55 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -31,7 +31,7 @@
#include "zend_language_scanner.h"
#define CONSTANT_EX(op_array, op) \
- (op_array)->literals[op].constant
+ (op_array)->literals[op]
#define CONSTANT(op) \
CONSTANT_EX(CG(active_op_array), op)
@@ -61,7 +61,7 @@
} while (0)
#define GET_CACHE_SLOT(literal) do { \
- CG(active_op_array)->literals[literal].cache_slot = CG(active_op_array)->last_cache_slot++; \
+ Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) = CG(active_op_array)->last_cache_slot++; \
if ((CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) && CG(active_op_array)->run_time_cache) { \
CG(active_op_array)->run_time_cache = erealloc(CG(active_op_array)->run_time_cache, CG(active_op_array)->last_cache_slot * sizeof(void*)); \
CG(active_op_array)->run_time_cache[CG(active_op_array)->last_cache_slot - 1] = NULL; \
@@ -71,7 +71,7 @@
#define POLYMORPHIC_CACHE_SLOT_SIZE 2
#define GET_POLYMORPHIC_CACHE_SLOT(literal) do { \
- CG(active_op_array)->literals[literal].cache_slot = CG(active_op_array)->last_cache_slot; \
+ Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) = CG(active_op_array)->last_cache_slot; \
CG(active_op_array)->last_cache_slot += POLYMORPHIC_CACHE_SLOT_SIZE; \
if ((CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) && CG(active_op_array)->run_time_cache) { \
CG(active_op_array)->run_time_cache = erealloc(CG(active_op_array)->run_time_cache, CG(active_op_array)->last_cache_slot * sizeof(void*)); \
@@ -81,10 +81,10 @@
} while (0)
#define FREE_POLYMORPHIC_CACHE_SLOT(literal) do { \
- if (CG(active_op_array)->literals[literal].cache_slot != -1 && \
- CG(active_op_array)->literals[literal].cache_slot == \
+ if (Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) != -1 && \
+ Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) == \
CG(active_op_array)->last_cache_slot - POLYMORPHIC_CACHE_SLOT_SIZE) { \
- CG(active_op_array)->literals[literal].cache_slot = -1; \
+ Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) = -1; \
CG(active_op_array)->last_cache_slot -= POLYMORPHIC_CACHE_SLOT_SIZE; \
} \
} while (0)
@@ -350,7 +350,7 @@ static inline void zend_insert_literal(zend_op_array *op_array, zval *zv, int li
}
}
ZVAL_COPY_VALUE(&CONSTANT_EX(op_array, literal_position), zv);
- op_array->literals[literal_position].cache_slot = -1;
+ Z_CACHE_SLOT(op_array->literals[literal_position]) = -1;
}
/* }}} */
@@ -365,7 +365,7 @@ int zend_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC) /* {{{ *
while (i >= CG(context).literals_size) {
CG(context).literals_size += 16; /* FIXME */
}
- op_array->literals = (zend_literal*)erealloc(op_array->literals, CG(context).literals_size * sizeof(zend_literal));
+ op_array->literals = (zval*)erealloc(op_array->literals, CG(context).literals_size * sizeof(zval));
}
zend_insert_literal(op_array, zv, i TSRMLS_CC);
return i;
@@ -378,7 +378,7 @@ int zend_append_individual_literal(zend_op_array *op_array, const zval *zv TSRML
{
int i = op_array->last_literal;
op_array->last_literal++;
- op_array->literals = (zend_literal*)erealloc(op_array->literals, (i + 1) * sizeof(zend_literal));
+ op_array->literals = (zval*)erealloc(op_array->literals, (i + 1) * sizeof(zval));
zend_insert_literal(op_array, zv, i TSRMLS_CC);
return i;
}
@@ -391,8 +391,8 @@ int zend_add_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC
zval c;
if (op_array->last_literal > 0 &&
- &op_array->literals[op_array->last_literal - 1].constant == zv &&
- op_array->literals[op_array->last_literal - 1].cache_slot == -1) {
+ &op_array->literals[op_array->last_literal - 1] == zv &&
+ Z_CACHE_SLOT(op_array->literals[op_array->last_literal - 1]) == -1) {
/* we already have function name as last literal (do nothing) */
ret = op_array->last_literal - 1;
} else {
@@ -417,8 +417,8 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS
zval c;
if (op_array->last_literal > 0 &&
- &op_array->literals[op_array->last_literal - 1].constant == zv &&
- op_array->literals[op_array->last_literal - 1].cache_slot == -1) {
+ &op_array->literals[op_array->last_literal - 1] == zv &&
+ Z_CACHE_SLOT(op_array->literals[op_array->last_literal - 1]) == -1) {
/* we already have function name as last literal (do nothing) */
ret = op_array->last_literal - 1;
} else {
@@ -452,8 +452,8 @@ int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_D
zval c;
if (op_array->last_literal > 0 &&
- &op_array->literals[op_array->last_literal - 1].constant == zv &&
- op_array->literals[op_array->last_literal - 1].cache_slot == -1) {
+ &op_array->literals[op_array->last_literal - 1] == zv &&
+ Z_CACHE_SLOT(op_array->literals[op_array->last_literal - 1]) == -1) {
/* we already have function name as last literal (do nothing) */
ret = op_array->last_literal - 1;
} else {
@@ -486,8 +486,8 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq
zval c;
if (op_array->last_literal > 0 &&
- &op_array->literals[op_array->last_literal - 1].constant == zv &&
- op_array->literals[op_array->last_literal - 1].cache_slot == -1) {
+ &op_array->literals[op_array->last_literal - 1] == zv &&
+ Z_CACHE_SLOT(op_array->literals[op_array->last_literal - 1]) == -1) {
/* we already have function name as last literal (do nothing) */
ret = op_array->last_literal - 1;
} else {
@@ -3847,9 +3847,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
}
}
- for (zend_hash_internal_pointer_reset(&ce->properties_info);
- (property_info = zend_hash_get_current_data_ptr(&ce->properties_info)) != NULL;
- zend_hash_move_forward(&ce->properties_info)) {
+ ZEND_HASH_FOREACH_PTR(&ce->properties_info, property_info) {
if (property_info->ce == ce) {
if (property_info->flags & ZEND_ACC_STATIC) {
property_info->offset += parent_ce->default_static_members_count;
@@ -3857,7 +3855,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
property_info->offset += parent_ce->default_properties_count;
}
}
- }
+ } ZEND_HASH_FOREACH_END();
zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (ce->type & ZEND_INTERNAL_CLASS ? zend_duplicate_property_info_internal_zval : zend_duplicate_property_info_zval), (merge_checker_func_t) do_inherit_property_access_check, ce);
@@ -4430,9 +4428,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
* - if compatible, then strict notice
*/
for (i = 0; i < ce->num_traits; i++) {
- for (zend_hash_internal_pointer_reset(&ce->traits[i]->properties_info);
- (property_info = zend_hash_get_current_data_ptr(&ce->traits[i]->properties_info)) != NULL;
- zend_hash_move_forward(&ce->traits[i]->properties_info)) {
+ ZEND_HASH_FOREACH_PTR(&ce->traits[i]->properties_info, property_info) {
/* first get the unmangeld name if necessary,
* then check whether the property is already there
*/
@@ -4507,7 +4503,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
prop_value, flags,
doc_comment TSRMLS_CC);
STR_RELEASE(prop_name);
- }
+ } ZEND_HASH_FOREACH_END();
}
}
/* }}} */
@@ -6209,7 +6205,7 @@ void zend_do_cast(znode *result, const znode *expr, int type TSRMLS_DC) /* {{{ *
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_CAST;
- opline->result_type = IS_TMP_VAR;
+ opline->result_type = IS_VAR;
opline->result.var = get_temporary_variable(CG(active_op_array));
SET_NODE(opline->op1, expr);
SET_UNUSED(opline->op2);
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index b8ac4f9b1f..6681455992 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -65,11 +65,6 @@ typedef struct _zend_compiler_context {
HashTable *labels;
} zend_compiler_context;
-typedef struct _zend_literal {
- zval constant;
- zend_uint cache_slot;
-} zend_literal;
-
typedef union _znode_op {
zend_uint constant;
zend_uint var;
@@ -78,7 +73,6 @@ typedef union _znode_op {
zend_uint opline_num; /* Needs to be signed */
zend_op *jmp_addr;
zval *zv;
- zend_literal *literal;
void *ptr; /* Used for passing pointers from the compile to execution phase, currently used for traits */
} znode_op;
@@ -294,7 +288,7 @@ struct _zend_op_array {
zend_string *doc_comment;
zend_uint early_binding; /* the linked list of delayed declarations */
- zend_literal *literals;
+ zval *literals;
int last_literal;
void **run_time_cache;
@@ -372,15 +366,23 @@ typedef struct _call_slot {
zend_bool is_ctor_result_used;
} call_slot;
+typedef enum _vm_frame_kind {
+ VM_FRAME_NESTED_FUNCTION, /* stackless VM call to function */
+ VM_FRAME_NESTED_CODE, /* stackless VM call to include/require/eval */
+ VM_FRAME_TOP_FUNCTION, /* direct VM call to function from external C code */
+ VM_FRAME_TOP_CODE /* direct VM call to "main" code from external C code */
+} vm_frame_kind;
+
struct _zend_execute_data {
struct _zend_op *opline;
+ void **run_time_cache;
zend_function_state function_state;
zend_op_array *op_array;
zend_object *object;
zend_array *symbol_table;
struct _zend_execute_data *prev_execute_data;
zval old_error_reporting;
- zend_bool nested;
+ vm_frame_kind frame_kind;
zval *return_value;
// TODO: simplify call sequence and remove current_* and call_* ???
zend_class_entry *current_scope;
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index d917fed502..f3c58065ee 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -440,28 +440,28 @@ finish:
return zend_get_constant(name, name_len, result TSRMLS_CC);
}
-zend_constant *zend_quick_get_constant(const zend_literal *key, ulong flags TSRMLS_DC)
+zend_constant *zend_quick_get_constant(const zval *key, ulong flags TSRMLS_DC)
{
zend_constant *c;
- if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR(key->constant))) == NULL) {
+ if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR_P(key))) == NULL) {
key++;
- if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR(key->constant))) == NULL ||
+ if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR_P(key))) == NULL ||
(c->flags & CONST_CS) != 0) {
if ((flags & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) {
key++;
- if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR(key->constant))) == NULL) {
+ if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR_P(key))) == NULL) {
key++;
- if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR(key->constant))) == NULL ||
+ if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR_P(key))) == NULL ||
(c->flags & CONST_CS) != 0) {
key--;
- c = zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant) TSRMLS_CC);
+ c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRLEN_P(key) TSRMLS_CC);
}
}
} else {
key--;
- c = zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant) TSRMLS_CC);
+ c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRLEN_P(key) TSRMLS_CC);
}
}
}
diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h
index 5ededead25..df7f27cf8f 100644
--- a/Zend/zend_constants.h
+++ b/Zend/zend_constants.h
@@ -75,7 +75,7 @@ ZEND_API void zend_register_string_constant(const char *name, uint name_len, cha
ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC);
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
void zend_copy_constants(HashTable *target, HashTable *sourc);
-zend_constant *zend_quick_get_constant(const zend_literal *key, ulong flags TSRMLS_DC);
+zend_constant *zend_quick_get_constant(const zval *key, ulong flags TSRMLS_DC);
END_EXTERN_C()
#define ZEND_CONSTANT_DTOR free_zend_constant
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index d548c4b695..b6a4031221 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -51,7 +51,9 @@
typedef int (*incdec_t)(zval *);
#define get_zval_ptr(op_type, node, ex, should_free, type) _get_zval_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
+#define get_zval_ptr_deref(op_type, node, ex, should_free, type) _get_zval_ptr_deref(op_type, node, ex, should_free, type TSRMLS_CC)
#define get_zval_ptr_ptr(op_type, node, ex, should_free, type) _get_zval_ptr_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
+#define get_zval_ptr_ptr_undef(op_type, node, ex, should_free, type) _get_zval_ptr_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
#define get_obj_zval_ptr(op_type, node, ex, should_free, type) _get_obj_zval_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
#define get_obj_zval_ptr_ptr(op_type, node, ex, should_free, type) _get_obj_zval_ptr_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
@@ -434,6 +436,19 @@ static zend_always_inline zval *_get_zval_ptr_ptr_var(zend_uint var, const zend_
}
}
+static inline zval *_get_zval_ptr_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
+{
+ zval *ret;
+
+ if (op_type == IS_CV) {
+ should_free->var = NULL;
+ return _get_zval_ptr_cv(execute_data, node->var, type TSRMLS_CC);
+ } else /* if (op_type == IS_VAR) */ {
+ ZEND_ASSERT(op_type == IS_VAR);
+ return _get_zval_ptr_ptr_var(node->var, execute_data, should_free TSRMLS_CC);
+ }
+}
+
static zend_always_inline zval *_get_obj_zval_ptr_unused(TSRMLS_D)
{
if (EXPECTED(Z_OBJ(EG(This)) != NULL)) {
@@ -457,6 +472,19 @@ static inline zval *_get_obj_zval_ptr(int op_type, znode_op *op, const zend_exec
return get_zval_ptr(op_type, op, execute_data, should_free, type);
}
+static inline zval *_get_obj_zval_ptr_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
+{
+ if (op_type == IS_UNUSED) {
+ if (EXPECTED(Z_OBJ(EG(This)) != NULL)) {
+ should_free->var = NULL;
+ return &EG(This);
+ } else {
+ zend_error_noreturn(E_ERROR, "Using $this when not in object context");
+ }
+ }
+ return get_zval_ptr_ptr(op_type, node, execute_data, should_free, type);
+}
+
static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr TSRMLS_DC)
{
if (EXPECTED(variable_ptr != value_ptr)) {
@@ -635,7 +663,7 @@ static void zend_verify_missing_arg(zend_execute_data *execute_data, zend_uint a
}
}
-static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *property_name, int value_type, znode_op *value_op, const zend_execute_data *execute_data, int opcode, const zend_literal *key TSRMLS_DC)
+static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *property_name, int value_type, znode_op *value_op, const zend_execute_data *execute_data, int opcode, zend_uint cache_slot TSRMLS_DC)
{
zend_free_op free_value;
zval *value = get_zval_ptr(value_type, value_op, execute_data, &free_value, BP_VAR_R);
@@ -716,7 +744,7 @@ static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *p
FREE_OP(free_value);
return;
}
- Z_OBJ_HT_P(object)->write_property(object, property_name, value, key TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property_name, value, cache_slot TSRMLS_CC);
} else {
/* Note: property_name in this case is really the array index! */
if (!Z_OBJ_HT_P(object)->write_dimension) {
@@ -1318,7 +1346,7 @@ static zend_never_inline void zend_fetch_dimension_address_read_IS(zval *result,
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS TSRMLS_CC);
}
-static void zend_fetch_property_address(zval *result, zval *container_ptr, zval *prop_ptr, const zend_literal *key, int type, int is_ref TSRMLS_DC)
+static void zend_fetch_property_address(zval *result, zval *container_ptr, zval *prop_ptr, zend_uint cache_slot, int type, int is_ref TSRMLS_DC)
{
zval *container = container_ptr;
@@ -1346,10 +1374,10 @@ static void zend_fetch_property_address(zval *result, zval *container_ptr, zval
}
if (Z_OBJ_HT_P(container)->get_property_ptr_ptr) {
- zval *ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, key TSRMLS_CC);
+ zval *ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, cache_slot TSRMLS_CC);
if (NULL == ptr) {
if (Z_OBJ_HT_P(container)->read_property &&
- (ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, key, result TSRMLS_CC)) != NULL) {
+ (ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result TSRMLS_CC)) != NULL) {
if (ptr != result) {
if (is_ref && ptr != &EG(uninitialized_zval)) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(ptr);
@@ -1370,7 +1398,7 @@ static void zend_fetch_property_address(zval *result, zval *container_ptr, zval
}
}
} else if (Z_OBJ_HT_P(container)->read_property) {
- zval *ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, key, result TSRMLS_CC);
+ zval *ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result TSRMLS_CC);
if (ptr != result) {
if (is_ref && ptr != &EG(uninitialized_zval)) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(ptr);
@@ -1532,7 +1560,7 @@ void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /*
* +----------------------------------------+
*/
-static zend_always_inline zend_execute_data *i_create_execute_data_from_op_array(zend_op_array *op_array, zval *return_value, zend_bool nested TSRMLS_DC) /* {{{ */
+static zend_always_inline zend_execute_data *i_create_execute_data_from_op_array(zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC) /* {{{ */
{
zend_execute_data *execute_data;
@@ -1622,16 +1650,17 @@ static zend_always_inline zend_execute_data *i_create_execute_data_from_op_array
EX(symbol_table) = EG(active_symbol_table);
EX(call) = NULL;
EG(current_execute_data) = execute_data;
- EX(nested) = nested;
+ EX(frame_kind) = frame_kind;
EX(delayed_exception) = NULL;
EX(return_value) = return_value;
if (!op_array->run_time_cache && op_array->last_cache_slot) {
op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*));
}
+ EX(run_time_cache) = op_array->run_time_cache;
- if (EG(active_symbol_table)) {
- zend_attach_symbol_table(TSRMLS_C);
+ if (EX(symbol_table)) {
+ zend_attach_symbol_table(execute_data);
}
if (op_array->this_var != -1 && Z_OBJ(EG(This))) {
@@ -1648,9 +1677,9 @@ static zend_always_inline zend_execute_data *i_create_execute_data_from_op_array
}
/* }}} */
-ZEND_API zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zval *return_value, zend_bool nested TSRMLS_DC) /* {{{ */
+ZEND_API zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC) /* {{{ */
{
- return i_create_execute_data_from_op_array(op_array, return_value, nested TSRMLS_CC);
+ return i_create_execute_data_from_op_array(op_array, return_value, frame_kind TSRMLS_CC);
}
/* }}} */
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index a7d97868fc..d632a97840 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -35,13 +35,13 @@ ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_pt
void init_executor(TSRMLS_D);
void shutdown_executor(TSRMLS_D);
void shutdown_destructors(TSRMLS_D);
-ZEND_API zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zval *return_value, zend_bool nested TSRMLS_DC);
+ZEND_API zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC);
ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value TSRMLS_DC);
ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC);
ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, struct _zend_fcall_info *fci TSRMLS_DC);
ZEND_API int zend_is_true(zval *op TSRMLS_DC);
ZEND_API zend_class_entry *zend_lookup_class(zend_string *name TSRMLS_DC);
-ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zend_literal *key, int use_autoload TSRMLS_DC);
+ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *key, int use_autoload TSRMLS_DC);
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *string_name TSRMLS_DC);
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
@@ -302,7 +302,7 @@ ZEND_API void zend_set_timeout(long seconds, int reset_signals);
ZEND_API void zend_unset_timeout(TSRMLS_D);
ZEND_API void zend_timeout(int dummy);
ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type TSRMLS_DC);
-ZEND_API zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zend_literal *key, int fetch_type TSRMLS_DC);
+ZEND_API zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval *key, int fetch_type TSRMLS_DC);
void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
#ifdef ZEND_WIN32
@@ -346,20 +346,37 @@ void zend_clean_and_cache_symbol_table(zend_array *symbol_table TSRMLS_DC);
void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC);
#define CACHED_PTR(num) \
- EG(active_op_array)->run_time_cache[(num)]
+ EX(run_time_cache)[(num)]
#define CACHE_PTR(num, ptr) do { \
- EG(active_op_array)->run_time_cache[(num)] = (ptr); \
+ EX(run_time_cache)[(num)] = (ptr); \
} while (0)
#define CACHED_POLYMORPHIC_PTR(num, ce) \
- ((EG(active_op_array)->run_time_cache[(num)] == (ce)) ? \
- EG(active_op_array)->run_time_cache[(num) + 1] : \
+ ((EX(run_time_cache)[(num)] == (ce)) ? \
+ EX(run_time_cache)[(num) + 1] : \
NULL)
#define CACHE_POLYMORPHIC_PTR(num, ce, ptr) do { \
- EG(active_op_array)->run_time_cache[(num)] = (ce); \
- EG(active_op_array)->run_time_cache[(num) + 1] = (ptr); \
+ EX(run_time_cache)[(num)] = (ce); \
+ EX(run_time_cache)[(num) + 1] = (ptr); \
+ } while (0)
+
+#define CACHED_PTR_EX(op_array, num) \
+ (op_array)->run_time_cache[(num)]
+
+#define CACHE_PTR_EX(op_array, num, ptr) do { \
+ (op_array)->run_time_cache[(num)] = (ptr); \
+ } while (0)
+
+#define CACHED_POLYMORPHIC_PTR_EX(op_array, num, ce) \
+ (((op_array)->run_time_cache[(num)] == (ce)) ? \
+ (op_array)->run_time_cache[(num) + 1] : \
+ NULL)
+
+#define CACHE_POLYMORPHIC_PTR_EX(op_array, num, ce, ptr) do { \
+ (op_array)->run_time_cache[(num)] = (ce); \
+ (op_array)->run_time_cache[(num) + 1] = (ptr); \
} while (0)
END_EXTERN_C()
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index a72fb5dd6d..8d5b55c84d 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -935,12 +935,12 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
zend_execute(EG(active_op_array), fci->retval TSRMLS_CC);
}
+ EG(active_op_array) = original_op_array;
+ EG(opline_ptr) = original_opline_ptr;
if (!fci->symbol_table && EG(active_symbol_table)) {
zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
}
EG(active_symbol_table) = calling_symbol_table;
- EG(active_op_array) = original_op_array;
- EG(opline_ptr) = original_opline_ptr;
} else if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) {
int call_via_handler = (EX(function_state).function->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0;
ZVAL_NULL(fci->retval);
@@ -1005,7 +1005,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
}
/* }}} */
-ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zend_literal *key, int use_autoload TSRMLS_DC) /* {{{ */
+ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *key, int use_autoload TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce = NULL;
zval args[1];
@@ -1016,7 +1016,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zend_li
zend_fcall_info_cache fcall_cache;
if (key) {
- lc_name = Z_STR(key->constant);
+ lc_name = Z_STR_P(key);
} else {
if (name == NULL || !name->len) {
return NULL;
@@ -1248,10 +1248,10 @@ void execute_new_code(TSRMLS_D) /* {{{ */
while (opline<end) {
if (opline->op1_type == IS_CONST) {
- opline->op1.zv = &CG(active_op_array)->literals[opline->op1.constant].constant;
+ opline->op1.zv = &CG(active_op_array)->literals[opline->op1.constant];
}
if (opline->op2_type == IS_CONST) {
- opline->op2.zv = &CG(active_op_array)->literals[opline->op2.constant].constant;
+ opline->op2.zv = &CG(active_op_array)->literals[opline->op2.constant];
}
switch (opline->opcode) {
case ZEND_GOTO:
@@ -1560,7 +1560,7 @@ check_fetch_type:
}
/* }}} */
-zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zend_literal *key, int fetch_type TSRMLS_DC) /* {{{ */
+zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval *key, int fetch_type TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce;
int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
@@ -1695,12 +1695,11 @@ ZEND_API void zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
}
/* }}} */
-ZEND_API void zend_attach_symbol_table(TSRMLS_D) /* {{{ */
+ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data) /* {{{ */
{
int i;
- zend_execute_data *execute_data = EG(current_execute_data);
zend_op_array *op_array = execute_data->op_array;
- HashTable *ht = &EG(active_symbol_table)->ht;
+ HashTable *ht = &execute_data->symbol_table->ht;
/* copy real values from symbol table into CV slots and create
INDIRECT references to CV in symbol table */
@@ -1727,12 +1726,11 @@ ZEND_API void zend_attach_symbol_table(TSRMLS_D) /* {{{ */
}
/* }}} */
-ZEND_API void zend_detach_symbol_table(TSRMLS_D) /* {{{ */
+ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data) /* {{{ */
{
int i;
- zend_execute_data *execute_data = EG(current_execute_data);
zend_op_array *op_array = execute_data->op_array;
- HashTable *ht = &EG(active_symbol_table)->ht;
+ HashTable *ht = &execute_data->symbol_table->ht;
/* copy real values from CV slots into symbol table */
for (i = 0; i < op_array->last_var; i++) {
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index 29941c12e3..74df4cdb7b 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -287,7 +287,7 @@ ZEND_API void zend_generator_create_zval(zend_op_array *op_array, zval *return_v
opline_ptr = EG(opline_ptr);
current_symbol_table = EG(active_symbol_table);
EG(active_symbol_table) = NULL;
- execute_data = zend_create_execute_data_from_op_array(op_array, return_value, 0 TSRMLS_CC);
+ execute_data = zend_create_execute_data_from_op_array(op_array, return_value, VM_FRAME_TOP_FUNCTION TSRMLS_CC);
EG(active_symbol_table) = current_symbol_table;
EG(current_execute_data) = current_execute_data;
EG(opline_ptr) = opline_ptr;
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index 11dc92d3c3..c770539dd1 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -533,6 +533,85 @@ static inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, HashPositio
#define zend_hash_get_current_data_ptr(ht) \
zend_hash_get_current_data_ptr_ex(ht, &(ht)->nInternalPointer)
+#define ZEND_HASH_FOREACH(_ht, indirect) do { \
+ uint _idx; \
+ for (_idx = 0; _idx < (_ht)->nNumUsed; _idx++) { \
+ Bucket *_p = (_ht)->arData + _idx; \
+ zval *_z = &_p->val; \
+ if (indirect && Z_TYPE_P(_z) == IS_INDIRECT) { \
+ _z = Z_INDIRECT_P(_z); \
+ } \
+ if (Z_TYPE_P(_z) == IS_UNDEF) continue;
+
+#define ZEND_HASH_REVERSE_FOREACH(_ht, indirect) do { \
+ uint _idx; \
+ for (_idx = (_ht)->nNumUsed; _idx > 0; _idx--) { \
+ Bucket *_p = (_ht)->arData + _idx - 1; \
+ zval *_z = &_p->val; \
+ if (indirect && Z_TYPE_P(_z) == IS_INDIRECT) { \
+ _z = Z_INDIRECT_P(_z); \
+ } \
+ if (Z_TYPE_P(_z) == IS_UNDEF) continue;
+
+#define ZEND_HASH_FOREACH_END() \
+ } \
+ } while (0)
+
+#define ZEND_HASH_FOREACH_VAL(ht, _val) \
+ ZEND_HASH_FOREACH(ht, 0); \
+ _val = _z;
+
+#define ZEND_HASH_FOREACH_VAL_IND(ht, _val) \
+ ZEND_HASH_FOREACH(ht, 1); \
+ _val = _z;
+
+#define ZEND_HASH_FOREACH_PTR(ht, _ptr) \
+ ZEND_HASH_FOREACH(ht, 0); \
+ _ptr = Z_PTR_P(_z);
+
+#define ZEND_HASH_FOREACH_KEY(ht, _h, _key) \
+ ZEND_HASH_FOREACH(ht, 0); \
+ _h = _p->h; \
+ _key = _p->key;
+
+#define ZEND_HASH_FOREACH_KEY_VAL(ht, _h, _key, _val) \
+ ZEND_HASH_FOREACH(ht, 0); \
+ _h = _p->h; \
+ _key = _p->key; \
+ _val = _z;
+
+#define ZEND_HASH_FOREACH_KEY_VAL_IND(ht, _h, _key, _val) \
+ ZEND_HASH_FOREACH(ht, 1); \
+ _h = _p->h; \
+ _key = _p->key; \
+ _val = _z;
+
+#define ZEND_HASH_FOREACH_KEY_PTR(ht, _h, _key, _ptr) \
+ ZEND_HASH_FOREACH(ht, 0); \
+ _h = _p->h; \
+ _key = _p->key; \
+ _ptr = Z_PTR_P(_z);
+
+#define ZEND_HASH_REVERSE_FOREACH_VAL(ht, _val) \
+ ZEND_HASH_REVERSE_FOREACH(ht, 0); \
+ _val = _z;
+
+#define ZEND_HASH_REVERSE_FOREACH_VAL_IND(ht, _val) \
+ ZEND_HASH_REVERSE_FOREACH(ht, 1); \
+ _val = _z;
+
+#define ZEND_HASH_REVERSE_FOREACH_KEY_VAL(ht, _h, _key, _val) \
+ ZEND_HASH_REVERSE_FOREACH(ht, 0); \
+ _h = _p->h; \
+ _key = _p->key; \
+ _val = _z;
+
+#define ZEND_HASH_REVERSE_FOREACH_KEY_VAL_IND(ht, _h, _key, _val) \
+ ZEND_HASH_REVERSE_FOREACH(ht, 1); \
+ _h = _p->h; \
+ _key = _p->key; \
+ _val = _z;
+
#endif /* ZEND_HASH_H */
/*
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c
index 3e9d9378b6..cf8889e0df 100644
--- a/Zend/zend_interfaces.c
+++ b/Zend/zend_interfaces.c
@@ -110,10 +110,10 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
}
}
/* copy arguments back, they might be changed by references */
- if (param_count > 0) {
+ if (param_count > 0 && Z_ISREF(params[0]) && !Z_ISREF_P(arg1)) {
ZVAL_COPY_VALUE(arg1, &params[0]);
}
- if (param_count > 1) {
+ if (param_count > 1 && Z_ISREF(params[1]) && !Z_ISREF_P(arg2)) {
ZVAL_COPY_VALUE(arg2, &params[1]);
}
if (!retval_ptr) {
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
index 5521964588..acd756bc99 100644
--- a/Zend/zend_list.c
+++ b/Zend/zend_list.c
@@ -315,15 +315,12 @@ ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_fu
ZEND_API int zend_fetch_list_dtor_id(const char *type_name)
{
zend_rsrc_list_dtors_entry *lde;
- HashPosition pos;
- zend_hash_internal_pointer_reset_ex(&list_destructors, &pos);
- while ((lde = zend_hash_get_current_data_ptr_ex(&list_destructors, &pos)) != NULL) {
+ ZEND_HASH_FOREACH_PTR(&list_destructors, lde) {
if (lde->type_name && (strcmp(type_name, lde->type_name) == 0)) {
return lde->resource_id;
}
- zend_hash_move_forward_ex(&list_destructors, &pos);
- }
+ } ZEND_HASH_FOREACH_END();
return 0;
}
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 862ba99bdc..6350e7ed09 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -71,16 +71,13 @@
ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
{
if (!zobj->properties) {
- HashPosition pos;
zend_property_info *prop_info;
zend_class_entry *ce = zobj->ce;
ALLOC_HASHTABLE(zobj->properties);
zend_hash_init(zobj->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
if (ce->default_properties_count) {
- for (zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- (prop_info = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL;
- zend_hash_move_forward_ex(&ce->properties_info, &pos)) {
+ ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
if (/*prop_info->ce == ce &&*/
(prop_info->flags & ZEND_ACC_STATIC) == 0 &&
prop_info->offset >= 0 &&
@@ -90,12 +87,10 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
ZVAL_INDIRECT(&zv, &zobj->properties_table[prop_info->offset]);
zend_hash_add(zobj->properties, prop_info->name, &zv);
}
- }
+ } ZEND_HASH_FOREACH_END();
while (ce->parent && ce->parent->default_properties_count) {
ce = ce->parent;
- for (zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- (prop_info = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL;
- zend_hash_move_forward_ex(&ce->properties_info, &pos)) {
+ ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
if (prop_info->ce == ce &&
(prop_info->flags & ZEND_ACC_STATIC) == 0 &&
(prop_info->flags & ZEND_ACC_PRIVATE) != 0 &&
@@ -106,7 +101,7 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
ZVAL_INDIRECT(&zv, &zobj->properties_table[prop_info->offset]);
zend_hash_add(zobj->properties, prop_info->name, &zv);
}
- }
+ } ZEND_HASH_FOREACH_END();
}
}
}
@@ -265,13 +260,13 @@ static zend_always_inline zend_bool is_derived_class(zend_class_entry *child_cla
}
/* }}} */
-static zend_always_inline struct _zend_property_info *zend_get_property_info_quick(zend_class_entry *ce, zend_string *member, int silent, const zend_literal *key TSRMLS_DC) /* {{{ */
+static zend_always_inline struct _zend_property_info *zend_get_property_info_quick(zend_class_entry *ce, zend_string *member, int silent, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
zend_property_info *property_info;
zend_property_info *scope_property_info;
zend_bool denied_access = 0;
- if (key && (property_info = CACHED_POLYMORPHIC_PTR(key->cache_slot, ce)) != NULL) {
+ if (cache_slot != -1 && (property_info = CACHED_POLYMORPHIC_PTR_EX(EG(active_op_array), cache_slot, ce)) != NULL) {
return property_info;
}
@@ -302,8 +297,8 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
if (UNEXPECTED((property_info->flags & ZEND_ACC_STATIC) != 0) && !silent) {
zend_error(E_STRICT, "Accessing static property %s::$%s as non static", ce->name->val, member->val);
}
- if (key) {
- CACHE_POLYMORPHIC_PTR(key->cache_slot, ce, property_info);
+ if (cache_slot != -1) {
+ CACHE_POLYMORPHIC_PTR_EX(EG(active_op_array), cache_slot, ce, property_info);
}
return property_info;
}
@@ -318,8 +313,8 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
&& is_derived_class(ce, EG(scope))
&& (scope_property_info = zend_hash_find_ptr(&EG(scope)->properties_info, member)) != NULL
&& scope_property_info->flags & ZEND_ACC_PRIVATE) {
- if (key) {
- CACHE_POLYMORPHIC_PTR(key->cache_slot, ce, scope_property_info);
+ if (cache_slot != -1) {
+ CACHE_POLYMORPHIC_PTR_EX(EG(active_op_array), cache_slot, ce, scope_property_info);
}
return scope_property_info;
} else if (property_info) {
@@ -331,8 +326,8 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
return NULL;
} else {
/* fall through, return property_info... */
- if (key) {
- CACHE_POLYMORPHIC_PTR(key->cache_slot, ce, property_info);
+ if (cache_slot != -1) {
+ CACHE_POLYMORPHIC_PTR_EX(EG(active_op_array), cache_slot, ce, property_info);
}
}
} else {
@@ -348,7 +343,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC) /* {{{ */
{
- return zend_get_property_info_quick(ce, Z_STR_P(member), silent, NULL TSRMLS_CC);
+ return zend_get_property_info_quick(ce, Z_STR_P(member), silent, -1 TSRMLS_CC);
}
/* }}} */
@@ -366,7 +361,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf
} else {
member = STR_COPY(prop_info_name);
}
- property_info = zend_get_property_info_quick(zobj->ce, member, 1, NULL TSRMLS_CC);
+ property_info = zend_get_property_info_quick(zobj->ce, member, 1, -1 TSRMLS_CC);
STR_RELEASE(member);
if (!property_info) {
return FAILURE;
@@ -421,7 +416,7 @@ static long *zend_get_property_guard(zend_object *zobj, zend_property_info *prop
}
/* }}} */
-zval *zend_std_read_property(zval *object, zval *member, int type, const zend_literal *key, zval *rv TSRMLS_DC) /* {{{ */
+zval *zend_std_read_property(zval *object, zval *member, int type, zend_uint cache_slot, zval *rv TSRMLS_DC) /* {{{ */
{
zend_object *zobj;
zval tmp_member;
@@ -437,7 +432,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, const zend_li
ZVAL_DUP(&tmp_member, member);
convert_to_string(&tmp_member);
member = &tmp_member;
- key = NULL;
+ cache_slot = -1;
}
#if DEBUG_OBJECT_HANDLERS
@@ -445,7 +440,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, const zend_li
#endif
/* make zend_get_property_info silent if we have getter - we may want to use it */
- property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), silent || (zobj->ce->__get != NULL), key TSRMLS_CC);
+ property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), silent || (zobj->ce->__get != NULL), cache_slot TSRMLS_CC);
if (EXPECTED(property_info != NULL)) {
if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
@@ -519,7 +514,7 @@ exit:
}
/* }}} */
-ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) /* {{{ */
+ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
zend_object *zobj;
zval tmp_member;
@@ -533,10 +528,10 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, c
ZVAL_DUP(&tmp_member, member);
convert_to_string(&tmp_member);
member = &tmp_member;
- key = NULL;
+ cache_slot = -1;
}
- property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__set != NULL), key TSRMLS_CC);
+ property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__set != NULL), cache_slot TSRMLS_CC);
if (EXPECTED(property_info != NULL)) {
if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
@@ -723,7 +718,7 @@ static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TS
}
/* }}} */
-static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */
+static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
zend_object *zobj;
zval tmp_member;
@@ -738,14 +733,14 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type,
ZVAL_DUP(&tmp_member, member);
convert_to_string(&tmp_member);
member = &tmp_member;
- key = NULL;
+ cache_slot = -1;
}
#if DEBUG_OBJECT_HANDLERS
fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
#endif
- property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__get != NULL), key TSRMLS_CC);
+ property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__get != NULL), cache_slot TSRMLS_CC);
if (EXPECTED(property_info != NULL)) {
if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
@@ -792,7 +787,7 @@ exit:
}
/* }}} */
-static void zend_std_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) /* {{{ */
+static void zend_std_unset_property(zval *object, zval *member, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
zend_object *zobj;
zval tmp_member;
@@ -805,10 +800,10 @@ static void zend_std_unset_property(zval *object, zval *member, const zend_liter
ZVAL_DUP(&tmp_member, member);
convert_to_string(&tmp_member);
member = &tmp_member;
- key = NULL;
+ cache_slot = -1;
}
- property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__unset != NULL), key TSRMLS_CC);
+ property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__unset != NULL), cache_slot TSRMLS_CC);
if (EXPECTED(property_info != NULL)) {
if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
@@ -1007,7 +1002,7 @@ static inline union _zend_function *zend_get_user_call_function(zend_class_entry
}
/* }}} */
-static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *method_name, const zend_literal *key TSRMLS_DC) /* {{{ */
+static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *method_name, const zval *key TSRMLS_DC) /* {{{ */
{
zend_object *zobj = *obj_ptr;
zval *func;
@@ -1015,7 +1010,7 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
zend_string *lc_method_name;
if (EXPECTED(key != NULL)) {
- lc_method_name = Z_STR(key->constant);
+ lc_method_name = Z_STR_P(key);
} else {
lc_method_name = STR_ALLOC(method_name->len, 0);
zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len);
@@ -1148,14 +1143,14 @@ static inline union _zend_function *zend_get_user_callstatic_function(zend_class
/* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */
-ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name, const zend_literal *key TSRMLS_DC) /* {{{ */
+ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name, const zval *key TSRMLS_DC) /* {{{ */
{
zend_function *fbc = NULL;
char *lc_class_name;
zend_string *lc_function_name;
if (EXPECTED(key != NULL)) {
- lc_function_name = Z_STR(key->constant);
+ lc_function_name = Z_STR_P(key);
} else {
lc_function_name = STR_ALLOC(function_name->len, 0);
zend_str_tolower_copy(lc_function_name->val, function_name->val, function_name->len);
@@ -1237,12 +1232,12 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
}
/* }}} */
-ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, const zend_literal *key TSRMLS_DC) /* {{{ */
+ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
zend_property_info *property_info;
- if (UNEXPECTED(!key) ||
- (property_info = CACHED_POLYMORPHIC_PTR(key->cache_slot, ce)) == NULL) {
+ if (UNEXPECTED(cache_slot == -1) ||
+ (property_info = CACHED_POLYMORPHIC_PTR_EX(EG(active_op_array), cache_slot, ce)) == NULL) {
if (UNEXPECTED((property_info = zend_hash_find_ptr(&ce->properties_info, property_name)) == NULL)) {
if (!silent) {
@@ -1267,8 +1262,8 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p
zend_update_class_constants(ce TSRMLS_CC);
- if (EXPECTED(key != NULL)) {
- CACHE_POLYMORPHIC_PTR(key->cache_slot, ce, property_info);
+ if (EXPECTED(cache_slot != -1)) {
+ CACHE_POLYMORPHIC_PTR_EX(EG(active_op_array), cache_slot, ce, property_info);
}
}
@@ -1284,7 +1279,7 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p
}
/* }}} */
-ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, const zend_literal *key TSRMLS_DC) /* {{{ */
+ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
zend_error_noreturn(E_ERROR, "Attempt to unset static property %s::$%s", ce->name->val, property_name->val);
return 0;
@@ -1389,7 +1384,7 @@ static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
}
/* }}} */
-static int zend_std_has_property(zval *object, zval *member, int has_set_exists, const zend_literal *key TSRMLS_DC) /* {{{ */
+static int zend_std_has_property(zval *object, zval *member, int has_set_exists, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
zend_object *zobj;
int result;
@@ -1404,10 +1399,10 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists,
ZVAL_DUP(&tmp_member, member);
convert_to_string(&tmp_member);
member = &tmp_member;
- key = NULL;
+ cache_slot = -1;
}
- property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), 1, key TSRMLS_CC);
+ property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), 1, cache_slot TSRMLS_CC);
if (EXPECTED(property_info != NULL)) {
if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h
index 48e2e49cd8..1b6c85b8c5 100644
--- a/Zend/zend_object_handlers.h
+++ b/Zend/zend_object_handlers.h
@@ -24,14 +24,13 @@
union _zend_function;
struct _zend_property_info;
-struct _zend_literal;
/* The following rule applies to read_property() and read_dimension() implementations:
If you return a zval which is not otherwise referenced by the extension or the engine's
symbol table, its reference count should be 0.
*/
/* Used to fetch property from the object, read-only */
-typedef zval *(*zend_object_read_property_t)(zval *object, zval *member, int type, const struct _zend_literal *key, zval *rv TSRMLS_DC);
+typedef zval *(*zend_object_read_property_t)(zval *object, zval *member, int type, zend_uint cache_slot, zval *rv TSRMLS_DC);
/* Used to fetch dimension from the object, read-only */
typedef zval *(*zend_object_read_dimension_t)(zval *object, zval *offset, int type, zval *rv TSRMLS_DC);
@@ -43,14 +42,14 @@ typedef zval *(*zend_object_read_dimension_t)(zval *object, zval *offset, int ty
any changes. You should NOT modify the reference count of the value passed to you.
*/
/* Used to set property of the object */
-typedef void (*zend_object_write_property_t)(zval *object, zval *member, zval *value, const struct _zend_literal *key TSRMLS_DC);
+typedef void (*zend_object_write_property_t)(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC);
/* Used to set dimension of the object */
typedef void (*zend_object_write_dimension_t)(zval *object, zval *offset, zval *value TSRMLS_DC);
/* Used to create pointer to the property of the object, for future direct r/w access */
-typedef zval *(*zend_object_get_property_ptr_ptr_t)(zval *object, zval *member, int type, const struct _zend_literal *key TSRMLS_DC);
+typedef zval *(*zend_object_get_property_ptr_ptr_t)(zval *object, zval *member, int type, zend_uint cache_slot TSRMLS_DC);
/* Used to set object value. Can be used to override assignments and scalar
write ops (like ++, +=) on the object */
@@ -67,13 +66,13 @@ typedef zval* (*zend_object_get_t)(zval *object, zval *rv TSRMLS_DC);
* 1 (set) whether property exists and is true
* 2 (exists) whether property exists
*/
-typedef int (*zend_object_has_property_t)(zval *object, zval *member, int has_set_exists, const struct _zend_literal *key TSRMLS_DC);
+typedef int (*zend_object_has_property_t)(zval *object, zval *member, int has_set_exists, zend_uint cache_slot TSRMLS_DC);
/* Used to check if a dimension of the object exists */
typedef int (*zend_object_has_dimension_t)(zval *object, zval *member, int check_empty TSRMLS_DC);
/* Used to remove a property of the object */
-typedef void (*zend_object_unset_property_t)(zval *object, zval *member, const struct _zend_literal *key TSRMLS_DC);
+typedef void (*zend_object_unset_property_t)(zval *object, zval *member, zend_uint cache_slot TSRMLS_DC);
/* Used to remove a dimension of the object */
typedef void (*zend_object_unset_dimension_t)(zval *object, zval *offset TSRMLS_DC);
@@ -88,7 +87,7 @@ typedef HashTable *(*zend_object_get_debug_info_t)(zval *object, int *is_temp TS
/* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this.
*/
typedef int (*zend_object_call_method_t)(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS);
-typedef union _zend_function *(*zend_object_get_method_t)(zend_object **object, zend_string *method, const struct _zend_literal *key TSRMLS_DC);
+typedef union _zend_function *(*zend_object_get_method_t)(zend_object **object, zend_string *method, const zval *key TSRMLS_DC);
typedef union _zend_function *(*zend_object_get_constructor_t)(zend_object *object TSRMLS_DC);
/* Object maintenance/destruction */
@@ -156,15 +155,15 @@ extern ZEND_API zend_object_handlers std_object_handlers;
((fbc)->common.prototype ? (fbc)->common.prototype->common.scope : (fbc)->common.scope)
BEGIN_EXTERN_C()
-ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name_strval, const struct _zend_literal *key TSRMLS_DC);
-ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, const struct _zend_literal *key TSRMLS_DC);
-ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, const struct _zend_literal *key TSRMLS_DC);
+ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name_strval, const zval *key TSRMLS_DC);
+ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, zend_uint cache_slot TSRMLS_DC);
+ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, zend_uint cache_slot TSRMLS_DC);
ZEND_API union _zend_function *zend_std_get_constructor(zend_object *object TSRMLS_DC);
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC);
ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC);
ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC);
ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC);
-ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, const struct _zend_literal *key TSRMLS_DC);
+ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC);
ZEND_API void rebuild_object_properties(zend_object *zobj);
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
index 390d6fc026..2ffec7cd8e 100644
--- a/Zend/zend_objects.c
+++ b/Zend/zend_objects.c
@@ -148,7 +148,6 @@ ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *o
}
}
if (old_object->properties) {
- HashPosition pos;
zval *prop, new_prop;
ulong num_key;
zend_string *key;
@@ -158,24 +157,19 @@ ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *o
zend_hash_init(new_object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
}
- for (zend_hash_internal_pointer_reset_ex(old_object->properties, &pos);
- (prop = zend_hash_get_current_data_ex(old_object->properties, &pos)) != NULL;
- zend_hash_move_forward_ex(old_object->properties, &pos)) {
+ ZEND_HASH_FOREACH_KEY_VAL(old_object->properties, num_key, key, prop) {
if (Z_TYPE_P(prop) == IS_INDIRECT) {
ZVAL_INDIRECT(&new_prop, new_object->properties_table + (Z_INDIRECT_P(prop) - old_object->properties_table));
} else {
ZVAL_COPY_VALUE(&new_prop, prop);
zval_add_ref(&new_prop);
}
- switch (zend_hash_get_current_key_ex(old_object->properties, &key, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- zend_hash_update(new_object->properties, key, &new_prop);
- break;
- case HASH_KEY_IS_LONG:
- zend_hash_index_update(new_object->properties, num_key, &new_prop);
- break;
+ if (key) {
+ zend_hash_update(new_object->properties, key, &new_prop);
+ } else {
+ zend_hash_index_update(new_object->properties, num_key, &new_prop);
}
- }
+ } ZEND_HASH_FOREACH_END();
}
if (old_object->ce->clone) {
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
index 3d97aaaf7a..285a752c2b 100644
--- a/Zend/zend_objects_API.c
+++ b/Zend/zend_objects_API.c
@@ -270,7 +270,7 @@ ZEND_API void zend_object_proxy_set(zval *property, zval *value TSRMLS_DC)
zend_proxy_object *probj = (zend_proxy_object*)Z_OBJ_P(property);
if (Z_OBJ_HT(probj->object) && Z_OBJ_HT(probj->object)->write_property) {
- Z_OBJ_HT(probj->object)->write_property(&probj->object, &probj->property, value, 0 TSRMLS_CC);
+ Z_OBJ_HT(probj->object)->write_property(&probj->object, &probj->property, value, -1 TSRMLS_CC);
} else {
zend_error(E_WARNING, "Cannot write property of object - no write handler defined");
}
@@ -281,7 +281,7 @@ ZEND_API zval* zend_object_proxy_get(zval *property TSRMLS_DC)
zend_proxy_object *probj = (zend_proxy_object*)Z_OBJ_P(property);
if (Z_OBJ_HT(probj->object) && Z_OBJ_HT(probj->object)->read_property) {
- return Z_OBJ_HT(probj->object)->read_property(&probj->object, &probj->property, BP_VAR_R, 0, NULL TSRMLS_CC);
+ return Z_OBJ_HT(probj->object)->read_property(&probj->object, &probj->property, BP_VAR_R, -1, NULL TSRMLS_CC);
} else {
zend_error(E_WARNING, "Cannot read property of object - no read handler defined");
}
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index f0883e8ccb..087960ca33 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -364,8 +364,8 @@ void zend_class_add_ref(zval *zv)
ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
{
- zend_literal *literal = op_array->literals;
- zend_literal *end;
+ zval *literal = op_array->literals;
+ zval *end;
zend_uint i;
if (op_array->static_variables) {
@@ -395,7 +395,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
if (literal) {
end = literal + op_array->last_literal;
while (literal < end) {
- zval_dtor(&literal->constant);
+ zval_dtor(literal);
literal++;
}
efree(op_array->literals);
@@ -638,7 +638,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
int nest_levels, array_offset;
zend_brk_cont_element *jmp_to;
- nest_levels = Z_LVAL(op_array->literals[opline->op2.constant].constant);
+ nest_levels = Z_LVAL(op_array->literals[opline->op2.constant]);
array_offset = opline->op1.opline_num;
do {
jmp_to = &op_array->brk_cont_array[array_offset];
@@ -650,9 +650,9 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
break;
}
case ZEND_GOTO:
- if (Z_TYPE(op_array->literals[opline->op2.constant].constant) != IS_LONG) {
+ if (Z_TYPE(op_array->literals[opline->op2.constant]) != IS_LONG) {
zend_uint num = opline->op2.constant;
- opline->op2.zv = &op_array->literals[opline->op2.constant].constant;
+ opline->op2.zv = &op_array->literals[opline->op2.constant];
zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC);
opline->op2.constant = num;
}
@@ -695,19 +695,19 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
CG(context).opcodes_size = op_array->last;
}
if (!(op_array->fn_flags & ZEND_ACC_INTERACTIVE) && CG(context).literals_size != op_array->last_literal) {
- op_array->literals = (zend_literal*)erealloc(op_array->literals, sizeof(zend_literal) * op_array->last_literal);
+ op_array->literals = (zval*)erealloc(op_array->literals, sizeof(zval) * op_array->last_literal);
CG(context).literals_size = op_array->last_literal;
}
opline = op_array->opcodes;
end = opline + op_array->last;
while (opline < end) {
if (opline->op1_type == IS_CONST) {
- opline->op1.zv = &op_array->literals[opline->op1.constant].constant;
+ opline->op1.zv = &op_array->literals[opline->op1.constant];
} else if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
opline->op1.var = (zend_uint)EX_VAR_NUM_2(NULL, op_array->last_var + opline->op1.var);
}
if (opline->op2_type == IS_CONST) {
- opline->op2.zv = &op_array->literals[opline->op2.constant].constant;
+ opline->op2.zv = &op_array->literals[opline->op2.constant];
} else if (opline->op2_type & (IS_VAR|IS_TMP_VAR)) {
opline->op2.var = (zend_uint)EX_VAR_NUM_2(NULL, op_array->last_var + opline->op2.var);
}
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
index 6b35b2af9b..0142e53c40 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -118,6 +118,7 @@ struct _zval_struct {
zend_uint var_flags;
zend_uint next; /* hash collision chain */
zend_uint str_offset; /* string offset */
+ zend_uint cache_slot; /* literal cache slot */
} u2;
};
@@ -237,6 +238,9 @@ static inline zend_uchar zval_get_type(const zval* pz) {
#define Z_NEXT(zval) (zval).u2.next
#define Z_NEXT_P(zval_p) Z_NEXT(*(zval_p))
+#define Z_CACHE_SLOT(zval) (zval).u2.cache_slot
+#define Z_CACHE_SLOT_P(zval_p) Z_CACHE_SLOT(*(zval_p))
+
#define Z_COUNTED(zval) (zval).value.counted
#define Z_COUNTED_P(zval_p) Z_COUNTED(*(zval_p))
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index d214459603..e3b58bcea8 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -356,7 +356,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -374,7 +374,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -395,7 +395,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -715,7 +715,7 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -731,7 +731,7 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -746,7 +746,7 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -805,7 +805,7 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -820,7 +820,7 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -836,7 +836,7 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -1104,10 +1104,10 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
zend_class_entry *ce;
if (OP2_TYPE == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (OP1_TYPE != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -1116,12 +1116,12 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((OP1_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
FREE_OP1();
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -1381,7 +1381,7 @@ ZEND_VM_HELPER(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST|TMP
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -1414,7 +1414,7 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -1438,7 +1438,7 @@ ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -1467,7 +1467,7 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -1497,7 +1497,7 @@ ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -1523,7 +1523,7 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -1569,7 +1569,7 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
FREE_OP2();
FREE_OP1_VAR_PTR();
/* assign_obj has two opcodes! */
@@ -1597,7 +1597,7 @@ ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
zend_free_op free_op2;
zval *property_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
FREE_OP2();
} else {
zend_free_op free_op2, free_op_data1, free_op_data2;
@@ -1748,96 +1748,103 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
{
- zend_bool nested = EX(nested);
- zend_op_array *op_array = EX(op_array);
+ vm_frame_kind frame_kind = EX(frame_kind);
- if ((nested && EX(prev_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL) ||
- EG(active_symbol_table) == &EG(symbol_table)) {
- zend_detach_symbol_table(TSRMLS_C);
- }
-
EG(current_execute_data) = EX(prev_execute_data);
- EG(opline_ptr) = NULL;
-
- if (EG(active_symbol_table) != &EG(symbol_table)) {
- i_free_compiled_variables(execute_data TSRMLS_CC);
- }
- zend_vm_stack_free((char*)execute_data TSRMLS_CC);
-
- if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) {
- zval_ptr_dtor((zval*)op_array->prototype);
- }
+ if (frame_kind == VM_FRAME_NESTED_FUNCTION) {
+ i_free_compiled_variables(execute_data TSRMLS_CC);
+ if (UNEXPECTED(EX(symbol_table) != NULL)) {
+ zend_clean_and_cache_symbol_table(EX(symbol_table) TSRMLS_CC);
+ }
+ if (UNEXPECTED((EX(op_array)->fn_flags & ZEND_ACC_CLOSURE) != 0) && EX(op_array)->prototype) {
+ zval_ptr_dtor((zval*)EX(op_array)->prototype);
+ }
+ zend_vm_stack_free((char*)execute_data TSRMLS_CC);
- if (nested) {
execute_data = EG(current_execute_data);
- }
- if (nested) {
- USE_OPLINE
-
- LOAD_REGS();
- LOAD_OPLINE();
- if (UNEXPECTED(opline->opcode == ZEND_INCLUDE_OR_EVAL)) {
-
- zend_attach_symbol_table(TSRMLS_C);
+ EG(opline_ptr) = &EX(opline);
+ EG(active_op_array) = EX(op_array);
+ EG(active_symbol_table) = EX(symbol_table);
- EX(function_state).function = (zend_function *) EX(op_array);
- EX(function_state).arguments = NULL;
+ EX(function_state).function = (zend_function *) EX(op_array);
+ EX(function_state).arguments = NULL;
- EG(opline_ptr) = &EX(opline);
- EG(active_op_array) = EX(op_array);
- destroy_op_array(op_array TSRMLS_CC);
- efree(op_array);
- if (UNEXPECTED(EG(exception) != NULL)) {
- zend_throw_exception_internal(NULL TSRMLS_CC);
- HANDLE_EXCEPTION_LEAVE();
+ if (Z_OBJ(EG(This))) {
+ if (UNEXPECTED(EG(exception) != NULL) && EX(call)->is_ctor_call) {
+ if (EX(call)->is_ctor_result_used) {
+ Z_DELREF(EG(This));
+ }
+ if (Z_REFCOUNT(EG(This)) == 1) {
+ zend_object_store_ctor_failed(Z_OBJ(EG(This)) TSRMLS_CC);
+ }
}
+ zval_ptr_dtor(&EG(This));
+ }
+ Z_OBJ(EG(This)) = EX(current_this);
+ EG(scope) = EX(current_scope);
+ EG(called_scope) = EX(current_called_scope);
- ZEND_VM_INC_OPCODE();
- ZEND_VM_LEAVE();
- } else {
- EG(opline_ptr) = &EX(opline);
- EG(active_op_array) = EX(op_array);
- if (EG(active_symbol_table)) {
- zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
- }
- EG(active_symbol_table) = EX(symbol_table);
+ EX(call)--;
- EX(function_state).function = (zend_function *) EX(op_array);
- EX(function_state).arguments = NULL;
+ zend_vm_stack_clear_multiple(1 TSRMLS_CC);
- if (Z_OBJ(EG(This))) {
- if (UNEXPECTED(EG(exception) != NULL) && EX(call)->is_ctor_call) {
- if (EX(call)->is_ctor_result_used) {
- Z_DELREF(EG(This));
- }
- if (Z_REFCOUNT(EG(This)) == 1) {
- zend_object_store_ctor_failed(Z_OBJ(EG(This)) TSRMLS_CC);
- }
- }
- zval_ptr_dtor(&EG(This));
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ zend_op *opline = EX(opline);
+ zend_throw_exception_internal(NULL TSRMLS_CC);
+ if (RETURN_VALUE_USED(opline)) {
+ zval_ptr_dtor(EX_VAR(opline->result.var));
}
- Z_OBJ(EG(This)) = EX(current_this);
- EG(scope) = EX(current_scope);
- EG(called_scope) = EX(current_called_scope);
+ HANDLE_EXCEPTION_LEAVE();
+ }
- EX(call)--;
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_LEAVE();
+ } else if (frame_kind == VM_FRAME_NESTED_CODE) {
+ zend_detach_symbol_table(execute_data);
+ destroy_op_array(EX(op_array) TSRMLS_CC);
+ efree(EX(op_array));
+ zend_vm_stack_free((char*)execute_data TSRMLS_CC);
- zend_vm_stack_clear_multiple(1 TSRMLS_CC);
+ execute_data = EG(current_execute_data);
+ zend_attach_symbol_table(execute_data);
+ EX(function_state).function = (zend_function *) EX(op_array);
+ EX(function_state).arguments = NULL;
+ EG(opline_ptr) = &EX(opline);
+ EG(active_op_array) = EX(op_array);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ zend_throw_exception_internal(NULL TSRMLS_CC);
+ HANDLE_EXCEPTION_LEAVE();
+ }
- if (UNEXPECTED(EG(exception) != NULL)) {
- zend_throw_exception_internal(NULL TSRMLS_CC);
- if (RETURN_VALUE_USED(opline)) {
- zval_ptr_dtor(EX_VAR(opline->result.var));
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_LEAVE();
+ } else {
+ if (frame_kind == VM_FRAME_TOP_FUNCTION) {
+ i_free_compiled_variables(execute_data TSRMLS_CC);
+ } else /* if (frame_kind == VM_FRAME_TOP_CODE) */ {
+ zend_array *symbol_table = EX(symbol_table);
+ zend_execute_data *old_execute_data;
+
+ zend_detach_symbol_table(execute_data);
+ old_execute_data = EX(prev_execute_data);
+ while (old_execute_data) {
+ if (old_execute_data->op_array) {
+ if (old_execute_data->symbol_table == symbol_table) {
+ zend_attach_symbol_table(old_execute_data);
+ }
+ break;
}
- HANDLE_EXCEPTION_LEAVE();
+ old_execute_data = old_execute_data->prev_execute_data;
}
-
- ZEND_VM_INC_OPCODE();
- ZEND_VM_LEAVE();
}
- }
- ZEND_VM_RETURN();
+ if ((EX(op_array)->fn_flags & ZEND_ACC_CLOSURE) && EX(op_array)->prototype) {
+ zval_ptr_dtor((zval*)EX(op_array)->prototype);
+ }
+ zend_vm_stack_free((char*)execute_data TSRMLS_CC);
+ EG(opline_ptr) = NULL;
+ ZEND_VM_RETURN();
+ }
}
ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
@@ -1951,7 +1958,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
}
} else if (EXPECTED(zend_execute_ex == execute_ex)) {
if (EXPECTED(EG(exception) == NULL)) {
- i_create_execute_data_from_op_array(EG(active_op_array), return_value, 1 TSRMLS_CC);
+ i_create_execute_data_from_op_array(EG(active_op_array), return_value, VM_FRAME_NESTED_FUNCTION TSRMLS_CC);
ZEND_VM_ENTER();
}
} else {
@@ -1960,7 +1967,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- if (EG(active_symbol_table)) {
+ if (UNEXPECTED(EG(active_symbol_table) != NULL)) {
zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
}
EG(active_symbol_table) = EX(symbol_table);
@@ -2312,11 +2319,11 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV)
zval *class_name = GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R);
if (OP2_TYPE == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
+ Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
} else {
- Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
- CACHE_PTR(opline->op2.literal->cache_slot, Z_CE_P(EX_VAR(opline->result.var)));
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
+ CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
@@ -2362,7 +2369,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (OP2_TYPE != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -2370,7 +2377,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((OP2_TYPE == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((OP2_TYPE == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -2378,7 +2385,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -2417,17 +2424,17 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
if (OP1_TYPE == IS_CONST) {
/* no function found. try a static method in class */
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
call->called_scope = ce;
} else {
@@ -2442,11 +2449,11 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
if (OP1_TYPE == IS_CONST &&
OP2_TYPE == IS_CONST &&
- CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (OP1_TYPE != IS_CONST &&
OP2_TYPE == IS_CONST &&
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce))) {
/* do nothing */
} else if (OP2_TYPE != IS_UNUSED) {
zend_free_op free_op2;
@@ -2464,7 +2471,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
if (ce->get_static_method) {
call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((OP2_TYPE == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((OP2_TYPE == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
}
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
@@ -2473,9 +2480,9 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (OP1_TYPE == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(function_name), call->fbc);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, call->fbc);
}
}
if (OP2_TYPE != IS_CONST) {
@@ -2527,15 +2534,15 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
call_slot *call = EX(call_slots) + opline->result.num;
if (OP2_TYPE == IS_CONST) {
- function_name_ptr = function_name = (zval*)(opline->op2.literal+1);
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ function_name_ptr = function_name = (zval*)(opline->op2.zv+1);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
call->fbc = Z_FUNC_P(func);
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), call->fbc);
}
call->object = NULL;
@@ -2672,25 +2679,25 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST)
{
USE_OPLINE
- zend_literal *func_name;
+ zval *func_name;
zval *func;
call_slot *call = EX(call_slots) + opline->result.num;
- func_name = opline->op2.literal + 1;
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if ((func = zend_hash_find(EG(function_table), Z_STR(func_name->constant))) == NULL) {
+ func_name = opline->op2.zv + 1;
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
+ } else if ((func = zend_hash_find(EG(function_table), Z_STR_P(func_name))) == NULL) {
func_name++;
- if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR(func_name->constant))) == NULL)) {
+ if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(func_name))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
call->fbc = Z_FUNC_P(func);
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), call->fbc);
}
} else {
call->fbc = Z_FUNC_P(func);
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), call->fbc);
}
call->object = NULL;
@@ -2716,14 +2723,14 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY)
zval *func;
call_slot *call = EX(call_slots) + opline->op2.num;
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- EX(function_state).function = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(fname))) {
+ EX(function_state).function = CACHED_PTR(Z_CACHE_SLOT_P(fname));
} else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(fname))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(fname));
} else {
EX(function_state).function = Z_FUNC_P(func);
- CACHE_PTR(opline->op1.literal->cache_slot, EX(function_state).function);
+ CACHE_PTR(Z_CACHE_SLOT_P(fname), EX(function_state).function);
}
call->fbc = EX(function_state).function;
@@ -2881,12 +2888,12 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]);
ZEND_VM_CONTINUE(); /* CHECK_ME */
}
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- catch_ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ catch_ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- catch_ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC);
+ catch_ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC);
- CACHE_PTR(opline->op1.literal->cache_slot, catch_ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), catch_ce);
}
ce = zend_get_class_entry(EG(exception) TSRMLS_CC);
@@ -3105,19 +3112,14 @@ ZEND_VM_C_LABEL(send_again):
switch (Z_TYPE_P(args)) {
case IS_ARRAY: {
HashTable *ht = Z_ARRVAL_P(args);
- HashPosition pos;
zval *arg;
+ zend_string *name;
+ zend_ulong index;
ZEND_VM_STACK_GROW_IF_NEEDED(zend_hash_num_elements(ht));
- for (zend_hash_internal_pointer_reset_ex(ht, &pos);
- (arg = zend_hash_get_current_data_ex(ht, &pos)) != NULL;
- zend_hash_move_forward_ex(ht, &pos), ++arg_num
- ) {
- zend_string *name;
- zend_ulong index;
-
- if (zend_hash_get_current_key_ex(ht, &name, &index, 0, &pos) == HASH_KEY_IS_STRING) {
+ ZEND_HASH_FOREACH_KEY_VAL(ht, index, name, arg) {
+ if (name) {
zend_error(E_RECOVERABLE_ERROR, "Cannot unpack array with string keys");
FREE_OP1();
CHECK_EXCEPTION();
@@ -3135,7 +3137,9 @@ ZEND_VM_C_LABEL(send_again):
zend_vm_stack_push(arg TSRMLS_CC);
EX(call)->num_additional_args++;
- }
+ arg_num++;
+ } ZEND_HASH_FOREACH_END();
+
break;
}
case IS_OBJECT: {
@@ -3539,9 +3543,9 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
zend_constant *c;
zval *retval;
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- c = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) {
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
+ } else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) {
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv));
if(!actual) {
@@ -3558,7 +3562,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
zend_error_noreturn(E_ERROR, "Undefined constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
} else {
- CACHE_PTR(opline->op2.literal->cache_slot, c);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), c);
}
retval = EX_VAR(opline->result.var);
ZVAL_DUP(retval, &c->value);
@@ -3570,26 +3574,26 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
zval *value;
if (OP1_TYPE == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- value = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ value = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
- } else if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ } else if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op1.var));
- if ((value = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce)) != NULL) {
+ if ((value = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce)) != NULL) {
ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -3608,9 +3612,9 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
EG(scope) = old_scope;
}
if (OP1_TYPE == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, value);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), value);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, value);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value);
}
ZVAL_DUP(EX_VAR(opline->result.var), value);
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
@@ -3721,11 +3725,27 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval *expr;
+ zval *expr, *expr_ptr;
zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
- expr = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
+ expr = expr_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
+ ZVAL_DEREF(expr);
+ }
+ if (Z_TYPE_P(expr) == opline->extended_value) {
+ ZVAL_COPY_VALUE(result, expr);
+ if (OP1_TYPE == IS_CONST || expr != expr_ptr) {
+ zval_opt_copy_ctor(result);
+ FREE_OP1_IF_VAR();
+ } else if (OP1_TYPE == IS_CV) {
+ if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
+
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!IS_OP1_TMP_FREE()) {
@@ -3733,7 +3753,6 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
}
}
-ZEND_VM_C_LABEL(cast_again):
switch (opline->extended_value) {
case IS_NULL:
convert_to_null(result);
@@ -3771,10 +3790,6 @@ ZEND_VM_C_LABEL(cast_again):
case IS_OBJECT:
convert_to_object(result);
break;
- case IS_REFERENCE:
- result = Z_REFVAL_P(result);
- ZEND_VM_C_GOTO(cast_again);
- break;
}
FREE_OP1_IF_VAR();
CHECK_EXCEPTION();
@@ -3883,7 +3898,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
}
if (EXPECTED(zend_execute_ex == execute_ex)) {
- i_create_execute_data_from_op_array(new_op_array, return_value, 1 TSRMLS_CC);
+ i_create_execute_data_from_op_array(new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
ZEND_VM_ENTER();
} else {
zend_execute(new_op_array, return_value TSRMLS_CC);
@@ -3941,10 +3956,10 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
zend_class_entry *ce;
if (OP2_TYPE == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (OP1_TYPE != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -3957,12 +3972,12 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((OP1_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -4089,7 +4104,7 @@ ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -4440,20 +4455,20 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
zend_class_entry *ce;
if (OP2_TYPE == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((OP1_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -4548,7 +4563,7 @@ ZEND_VM_C_LABEL(str_index_prop):
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
@@ -4933,15 +4948,15 @@ ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, CONST)
zend_class_entry *iface;
SAVE_OPLINE();
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- iface = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ iface = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- iface = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
+ iface = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(iface == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, iface);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), iface);
}
if (UNEXPECTED((iface->ce_flags & ZEND_ACC_INTERFACE) == 0)) {
@@ -4960,11 +4975,11 @@ ZEND_VM_HANDLER(154, ZEND_ADD_TRAIT, ANY, ANY)
zend_class_entry *trait;
SAVE_OPLINE();
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- trait = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ trait = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
trait = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv),
- opline->op2.literal + 1,
+ opline->op2.zv + 1,
opline->extended_value TSRMLS_CC);
if (UNEXPECTED(trait == NULL)) {
CHECK_EXCEPTION();
@@ -4973,7 +4988,7 @@ ZEND_VM_HANDLER(154, ZEND_ADD_TRAIT, ANY, ANY)
if (!((trait->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT)) {
zend_error_noreturn(E_ERROR, "%s cannot use %s - it is not a trait", ce->name->val, trait->name->val);
}
- CACHE_PTR(opline->op2.literal->cache_slot, trait);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), trait);
}
zend_do_implement_trait(ce, trait TSRMLS_CC);
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index adc978ecda..482ea3109d 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -378,101 +378,108 @@ ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value TSRMLS_DC
if (EG(exception) != NULL) {
return;
}
- zend_execute_ex(i_create_execute_data_from_op_array(op_array, return_value, 0 TSRMLS_CC) TSRMLS_CC);
+ zend_execute_ex(i_create_execute_data_from_op_array(op_array, return_value, EG(active_symbol_table) ? VM_FRAME_TOP_CODE : VM_FRAME_TOP_FUNCTION TSRMLS_CC) TSRMLS_CC);
}
static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
{
- zend_bool nested = EX(nested);
- zend_op_array *op_array = EX(op_array);
-
- if ((nested && EX(prev_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL) ||
- EG(active_symbol_table) == &EG(symbol_table)) {
- zend_detach_symbol_table(TSRMLS_C);
- }
+ vm_frame_kind frame_kind = EX(frame_kind);
EG(current_execute_data) = EX(prev_execute_data);
- EG(opline_ptr) = NULL;
- if (EG(active_symbol_table) != &EG(symbol_table)) {
+ if (frame_kind == VM_FRAME_NESTED_FUNCTION) {
i_free_compiled_variables(execute_data TSRMLS_CC);
- }
-
- zend_vm_stack_free((char*)execute_data TSRMLS_CC);
-
- if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) {
- zval_ptr_dtor((zval*)op_array->prototype);
- }
+ if (UNEXPECTED(EX(symbol_table) != NULL)) {
+ zend_clean_and_cache_symbol_table(EX(symbol_table) TSRMLS_CC);
+ }
+ if (UNEXPECTED((EX(op_array)->fn_flags & ZEND_ACC_CLOSURE) != 0) && EX(op_array)->prototype) {
+ zval_ptr_dtor((zval*)EX(op_array)->prototype);
+ }
+ zend_vm_stack_free((char*)execute_data TSRMLS_CC);
- if (nested) {
execute_data = EG(current_execute_data);
- }
- if (nested) {
- USE_OPLINE
-
- LOAD_REGS();
- LOAD_OPLINE();
- if (UNEXPECTED(opline->opcode == ZEND_INCLUDE_OR_EVAL)) {
-
- zend_attach_symbol_table(TSRMLS_C);
+ EG(opline_ptr) = &EX(opline);
+ EG(active_op_array) = EX(op_array);
+ EG(active_symbol_table) = EX(symbol_table);
- EX(function_state).function = (zend_function *) EX(op_array);
- EX(function_state).arguments = NULL;
+ EX(function_state).function = (zend_function *) EX(op_array);
+ EX(function_state).arguments = NULL;
- EG(opline_ptr) = &EX(opline);
- EG(active_op_array) = EX(op_array);
- destroy_op_array(op_array TSRMLS_CC);
- efree(op_array);
- if (UNEXPECTED(EG(exception) != NULL)) {
- zend_throw_exception_internal(NULL TSRMLS_CC);
- HANDLE_EXCEPTION_LEAVE();
+ if (Z_OBJ(EG(This))) {
+ if (UNEXPECTED(EG(exception) != NULL) && EX(call)->is_ctor_call) {
+ if (EX(call)->is_ctor_result_used) {
+ Z_DELREF(EG(This));
+ }
+ if (Z_REFCOUNT(EG(This)) == 1) {
+ zend_object_store_ctor_failed(Z_OBJ(EG(This)) TSRMLS_CC);
+ }
}
+ zval_ptr_dtor(&EG(This));
+ }
+ Z_OBJ(EG(This)) = EX(current_this);
+ EG(scope) = EX(current_scope);
+ EG(called_scope) = EX(current_called_scope);
- ZEND_VM_INC_OPCODE();
- ZEND_VM_LEAVE();
- } else {
- EG(opline_ptr) = &EX(opline);
- EG(active_op_array) = EX(op_array);
- if (EG(active_symbol_table)) {
- zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
- }
- EG(active_symbol_table) = EX(symbol_table);
+ EX(call)--;
- EX(function_state).function = (zend_function *) EX(op_array);
- EX(function_state).arguments = NULL;
+ zend_vm_stack_clear_multiple(1 TSRMLS_CC);
- if (Z_OBJ(EG(This))) {
- if (UNEXPECTED(EG(exception) != NULL) && EX(call)->is_ctor_call) {
- if (EX(call)->is_ctor_result_used) {
- Z_DELREF(EG(This));
- }
- if (Z_REFCOUNT(EG(This)) == 1) {
- zend_object_store_ctor_failed(Z_OBJ(EG(This)) TSRMLS_CC);
- }
- }
- zval_ptr_dtor(&EG(This));
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ zend_op *opline = EX(opline);
+ zend_throw_exception_internal(NULL TSRMLS_CC);
+ if (RETURN_VALUE_USED(opline)) {
+ zval_ptr_dtor(EX_VAR(opline->result.var));
}
- Z_OBJ(EG(This)) = EX(current_this);
- EG(scope) = EX(current_scope);
- EG(called_scope) = EX(current_called_scope);
+ HANDLE_EXCEPTION_LEAVE();
+ }
- EX(call)--;
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_LEAVE();
+ } else if (frame_kind == VM_FRAME_NESTED_CODE) {
+ zend_detach_symbol_table(execute_data);
+ destroy_op_array(EX(op_array) TSRMLS_CC);
+ efree(EX(op_array));
+ zend_vm_stack_free((char*)execute_data TSRMLS_CC);
+
+ execute_data = EG(current_execute_data);
+ zend_attach_symbol_table(execute_data);
+ EX(function_state).function = (zend_function *) EX(op_array);
+ EX(function_state).arguments = NULL;
+ EG(opline_ptr) = &EX(opline);
+ EG(active_op_array) = EX(op_array);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ zend_throw_exception_internal(NULL TSRMLS_CC);
+ HANDLE_EXCEPTION_LEAVE();
+ }
- zend_vm_stack_clear_multiple(1 TSRMLS_CC);
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_LEAVE();
+ } else {
+ if (frame_kind == VM_FRAME_TOP_FUNCTION) {
+ i_free_compiled_variables(execute_data TSRMLS_CC);
+ } else /* if (frame_kind == VM_FRAME_TOP_CODE) */ {
+ zend_array *symbol_table = EX(symbol_table);
+ zend_execute_data *old_execute_data;
- if (UNEXPECTED(EG(exception) != NULL)) {
- zend_throw_exception_internal(NULL TSRMLS_CC);
- if (RETURN_VALUE_USED(opline)) {
- zval_ptr_dtor(EX_VAR(opline->result.var));
+ zend_detach_symbol_table(execute_data);
+ old_execute_data = EX(prev_execute_data);
+ while (old_execute_data) {
+ if (old_execute_data->op_array) {
+ if (old_execute_data->symbol_table == symbol_table) {
+ zend_attach_symbol_table(old_execute_data);
+ }
+ break;
}
- HANDLE_EXCEPTION_LEAVE();
+ old_execute_data = old_execute_data->prev_execute_data;
}
-
- ZEND_VM_INC_OPCODE();
- ZEND_VM_LEAVE();
}
+ if ((EX(op_array)->fn_flags & ZEND_ACC_CLOSURE) && EX(op_array)->prototype) {
+ zval_ptr_dtor((zval*)EX(op_array)->prototype);
+ }
+ zend_vm_stack_free((char*)execute_data TSRMLS_CC);
+ EG(opline_ptr) = NULL;
+ ZEND_VM_RETURN();
}
- ZEND_VM_RETURN();
}
static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
@@ -586,7 +593,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
}
} else if (EXPECTED(zend_execute_ex == execute_ex)) {
if (EXPECTED(EG(exception) == NULL)) {
- i_create_execute_data_from_op_array(EG(active_op_array), return_value, 1 TSRMLS_CC);
+ i_create_execute_data_from_op_array(EG(active_op_array), return_value, VM_FRAME_NESTED_FUNCTION TSRMLS_CC);
ZEND_VM_ENTER();
}
} else {
@@ -595,7 +602,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- if (EG(active_symbol_table)) {
+ if (UNEXPECTED(EG(active_symbol_table) != NULL)) {
zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
}
EG(active_symbol_table) = EX(symbol_table);
@@ -713,19 +720,14 @@ send_again:
switch (Z_TYPE_P(args)) {
case IS_ARRAY: {
HashTable *ht = Z_ARRVAL_P(args);
- HashPosition pos;
zval *arg;
+ zend_string *name;
+ zend_ulong index;
ZEND_VM_STACK_GROW_IF_NEEDED(zend_hash_num_elements(ht));
- for (zend_hash_internal_pointer_reset_ex(ht, &pos);
- (arg = zend_hash_get_current_data_ex(ht, &pos)) != NULL;
- zend_hash_move_forward_ex(ht, &pos), ++arg_num
- ) {
- zend_string *name;
- zend_ulong index;
-
- if (zend_hash_get_current_key_ex(ht, &name, &index, 0, &pos) == HASH_KEY_IS_STRING) {
+ ZEND_HASH_FOREACH_KEY_VAL(ht, index, name, arg) {
+ if (name) {
zend_error(E_RECOVERABLE_ERROR, "Cannot unpack array with string keys");
FREE_OP(free_op1);
CHECK_EXCEPTION();
@@ -743,7 +745,9 @@ send_again:
zend_vm_stack_push(arg TSRMLS_CC);
EX(call)->num_additional_args++;
- }
+ arg_num++;
+ } ZEND_HASH_FOREACH_END();
+
break;
}
case IS_OBJECT: {
@@ -1113,11 +1117,11 @@ static int ZEND_FASTCALL ZEND_ADD_TRAIT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_class_entry *trait;
SAVE_OPLINE();
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- trait = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ trait = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
trait = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv),
- opline->op2.literal + 1,
+ opline->op2.zv + 1,
opline->extended_value TSRMLS_CC);
if (UNEXPECTED(trait == NULL)) {
CHECK_EXCEPTION();
@@ -1126,7 +1130,7 @@ static int ZEND_FASTCALL ZEND_ADD_TRAIT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (!((trait->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT)) {
zend_error_noreturn(E_ERROR, "%s cannot use %s - it is not a trait", ce->name->val, trait->name->val);
}
- CACHE_PTR(opline->op2.literal->cache_slot, trait);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), trait);
}
zend_do_implement_trait(ce, trait TSRMLS_CC);
@@ -1383,11 +1387,11 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE
zval *class_name = opline->op2.zv;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
+ Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
} else {
- Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
- CACHE_PTR(opline->op2.literal->cache_slot, Z_CE_P(EX_VAR(opline->result.var)));
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
+ CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
@@ -1412,15 +1416,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
call_slot *call = EX(call_slots) + opline->result.num;
if (IS_CONST == IS_CONST) {
- function_name_ptr = function_name = (zval*)(opline->op2.literal+1);
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ function_name_ptr = function_name = (zval*)(opline->op2.zv+1);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
call->fbc = Z_FUNC_P(func);
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), call->fbc);
}
call->object = NULL;
@@ -1555,25 +1559,25 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
static int ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_literal *func_name;
+ zval *func_name;
zval *func;
call_slot *call = EX(call_slots) + opline->result.num;
- func_name = opline->op2.literal + 1;
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if ((func = zend_hash_find(EG(function_table), Z_STR(func_name->constant))) == NULL) {
+ func_name = opline->op2.zv + 1;
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
+ } else if ((func = zend_hash_find(EG(function_table), Z_STR_P(func_name))) == NULL) {
func_name++;
- if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR(func_name->constant))) == NULL)) {
+ if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(func_name))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
call->fbc = Z_FUNC_P(func);
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), call->fbc);
}
} else {
call->fbc = Z_FUNC_P(func);
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), call->fbc);
}
call->object = NULL;
@@ -1675,15 +1679,15 @@ static int ZEND_FASTCALL ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
zend_class_entry *iface;
SAVE_OPLINE();
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- iface = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ iface = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- iface = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
+ iface = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(iface == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, iface);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), iface);
}
if (UNEXPECTED((iface->ce_flags & ZEND_ACC_INTERFACE) == 0)) {
@@ -1712,11 +1716,11 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
zval *class_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_TMP_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
+ Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
} else {
- Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
- CACHE_PTR(opline->op2.literal->cache_slot, Z_CE_P(EX_VAR(opline->result.var)));
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
+ CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
@@ -1742,15 +1746,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
call_slot *call = EX(call_slots) + opline->result.num;
if (IS_TMP_VAR == IS_CONST) {
- function_name_ptr = function_name = (zval*)(opline->op2.literal+1);
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ function_name_ptr = function_name = (zval*)(opline->op2.zv+1);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
call->fbc = Z_FUNC_P(func);
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), call->fbc);
}
call->object = NULL;
@@ -1901,11 +1905,11 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_
zval *class_name = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
+ Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
} else {
- Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
- CACHE_PTR(opline->op2.literal->cache_slot, Z_CE_P(EX_VAR(opline->result.var)));
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
+ CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
@@ -1931,15 +1935,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
call_slot *call = EX(call_slots) + opline->result.num;
if (IS_VAR == IS_CONST) {
- function_name_ptr = function_name = (zval*)(opline->op2.literal+1);
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ function_name_ptr = function_name = (zval*)(opline->op2.zv+1);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
call->fbc = Z_FUNC_P(func);
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), call->fbc);
}
call->object = NULL;
@@ -2090,11 +2094,11 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDL
zval *class_name = NULL;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
+ Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
} else {
- Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
- CACHE_PTR(opline->op2.literal->cache_slot, Z_CE_P(EX_VAR(opline->result.var)));
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
+ CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
@@ -2129,11 +2133,11 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A
zval *class_name = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (IS_CV == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
+ Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
} else {
- Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
- CACHE_PTR(opline->op2.literal->cache_slot, Z_CE_P(EX_VAR(opline->result.var)));
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
+ CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
@@ -2158,15 +2162,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
call_slot *call = EX(call_slots) + opline->result.num;
if (IS_CV == IS_CONST) {
- function_name_ptr = function_name = (zval*)(opline->op2.literal+1);
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ function_name_ptr = function_name = (zval*)(opline->op2.zv+1);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
call->fbc = Z_FUNC_P(func);
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), call->fbc);
}
call->object = NULL;
@@ -2509,14 +2513,14 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
zval *func;
call_slot *call = EX(call_slots) + opline->op2.num;
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- EX(function_state).function = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(fname))) {
+ EX(function_state).function = CACHED_PTR(Z_CACHE_SLOT_P(fname));
} else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(fname))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(fname));
} else {
EX(function_state).function = Z_FUNC_P(func);
- CACHE_PTR(opline->op1.literal->cache_slot, EX(function_state).function);
+ CACHE_PTR(Z_CACHE_SLOT_P(fname), EX(function_state).function);
}
call->fbc = EX(function_state).function;
@@ -2751,11 +2755,27 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *expr;
+ zval *expr, *expr_ptr;
zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
- expr = opline->op1.zv;
+ expr = expr_ptr = opline->op1.zv;
+ if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
+ ZVAL_DEREF(expr);
+ }
+ if (Z_TYPE_P(expr) == opline->extended_value) {
+ ZVAL_COPY_VALUE(result, expr);
+ if (IS_CONST == IS_CONST || expr != expr_ptr) {
+ zval_opt_copy_ctor(result);
+
+ } else if (IS_CONST == IS_CV) {
+ if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
+
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!0) {
@@ -2763,7 +2783,6 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
}
-cast_again:
switch (opline->extended_value) {
case IS_NULL:
convert_to_null(result);
@@ -2801,10 +2820,6 @@ cast_again:
case IS_OBJECT:
convert_to_object(result);
break;
- case IS_REFERENCE:
- result = Z_REFVAL_P(result);
- goto cast_again;
- break;
}
CHECK_EXCEPTION();
@@ -2913,7 +2928,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
}
if (EXPECTED(zend_execute_ex == execute_ex)) {
- i_create_execute_data_from_op_array(new_op_array, return_value, 1 TSRMLS_CC);
+ i_create_execute_data_from_op_array(new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
ZEND_VM_ENTER();
} else {
zend_execute(new_op_array, return_value TSRMLS_CC);
@@ -3521,10 +3536,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
zend_class_entry *ce;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CONST != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -3533,12 +3548,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -3694,17 +3709,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
if (IS_CONST == IS_CONST) {
/* no function found. try a static method in class */
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
call->called_scope = ce;
} else {
@@ -3719,11 +3734,11 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
if (IS_CONST == IS_CONST &&
IS_CONST == IS_CONST &&
- CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (IS_CONST != IS_CONST &&
IS_CONST == IS_CONST &&
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce))) {
/* do nothing */
} else if (IS_CONST != IS_UNUSED) {
@@ -3741,7 +3756,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
if (ce->get_static_method) {
call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
}
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
@@ -3750,9 +3765,9 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (IS_CONST == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(function_name), call->fbc);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, call->fbc);
}
}
if (IS_CONST != IS_CONST) {
@@ -3821,9 +3836,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
zend_constant *c;
zval *retval;
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- c = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) {
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
+ } else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) {
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv));
if(!actual) {
@@ -3840,7 +3855,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
zend_error_noreturn(E_ERROR, "Undefined constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
} else {
- CACHE_PTR(opline->op2.literal->cache_slot, c);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), c);
}
retval = EX_VAR(opline->result.var);
ZVAL_DUP(retval, &c->value);
@@ -3852,26 +3867,26 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
zval *value;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- value = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ value = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
- } else if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ } else if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op1.var));
- if ((value = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce)) != NULL) {
+ if ((value = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce)) != NULL) {
ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -3890,9 +3905,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
EG(scope) = old_scope;
}
if (IS_CONST == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, value);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), value);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, value);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value);
}
ZVAL_DUP(EX_VAR(opline->result.var), value);
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
@@ -4034,10 +4049,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA
zend_class_entry *ce;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_CONST != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -4050,12 +4065,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -4102,20 +4117,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O
zend_class_entry *ce;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -4620,17 +4635,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
if (IS_CONST == IS_CONST) {
/* no function found. try a static method in class */
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
call->called_scope = ce;
} else {
@@ -4645,11 +4660,11 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
if (IS_CONST == IS_CONST &&
IS_TMP_VAR == IS_CONST &&
- CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (IS_CONST != IS_CONST &&
IS_TMP_VAR == IS_CONST &&
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce))) {
/* do nothing */
} else if (IS_TMP_VAR != IS_UNUSED) {
zend_free_op free_op2;
@@ -4667,7 +4682,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
if (ce->get_static_method) {
call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
}
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
@@ -4676,9 +4691,9 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (IS_CONST == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(function_name), call->fbc);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, call->fbc);
}
}
if (IS_TMP_VAR != IS_CONST) {
@@ -5259,10 +5274,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
zend_class_entry *ce;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CONST != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -5271,12 +5286,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -5410,17 +5425,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
if (IS_CONST == IS_CONST) {
/* no function found. try a static method in class */
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
call->called_scope = ce;
} else {
@@ -5435,11 +5450,11 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
if (IS_CONST == IS_CONST &&
IS_VAR == IS_CONST &&
- CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (IS_CONST != IS_CONST &&
IS_VAR == IS_CONST &&
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce))) {
/* do nothing */
} else if (IS_VAR != IS_UNUSED) {
zend_free_op free_op2;
@@ -5457,7 +5472,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
if (ce->get_static_method) {
call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
}
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
@@ -5466,9 +5481,9 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (IS_CONST == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(function_name), call->fbc);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, call->fbc);
}
}
if (IS_VAR != IS_CONST) {
@@ -5655,10 +5670,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND
zend_class_entry *ce;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_CONST != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -5671,12 +5686,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -5723,20 +5738,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC
zend_class_entry *ce;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -5924,10 +5939,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
zend_class_entry *ce;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CONST != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -5936,12 +5951,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -6058,17 +6073,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
if (IS_CONST == IS_CONST) {
/* no function found. try a static method in class */
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
call->called_scope = ce;
} else {
@@ -6083,11 +6098,11 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
if (IS_CONST == IS_CONST &&
IS_UNUSED == IS_CONST &&
- CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (IS_CONST != IS_CONST &&
IS_UNUSED == IS_CONST &&
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce))) {
/* do nothing */
} else if (IS_UNUSED != IS_UNUSED) {
@@ -6105,7 +6120,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
if (ce->get_static_method) {
call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_UNUSED == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_UNUSED == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
}
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
@@ -6114,9 +6129,9 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (IS_CONST == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(function_name), call->fbc);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, call->fbc);
}
}
if (IS_UNUSED != IS_CONST) {
@@ -6287,10 +6302,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H
zend_class_entry *ce;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_CONST != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -6303,12 +6318,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -6355,20 +6370,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_
zend_class_entry *ce;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -6855,17 +6870,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
if (IS_CONST == IS_CONST) {
/* no function found. try a static method in class */
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
call->called_scope = ce;
} else {
@@ -6880,11 +6895,11 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
if (IS_CONST == IS_CONST &&
IS_CV == IS_CONST &&
- CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (IS_CONST != IS_CONST &&
IS_CV == IS_CONST &&
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce))) {
/* do nothing */
} else if (IS_CV != IS_UNUSED) {
@@ -6902,7 +6917,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
if (ce->get_static_method) {
call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
}
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
@@ -6911,9 +6926,9 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (IS_CONST == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(function_name), call->fbc);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, call->fbc);
}
}
if (IS_CV != IS_CONST) {
@@ -6971,12 +6986,12 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]);
ZEND_VM_CONTINUE(); /* CHECK_ME */
}
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- catch_ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ catch_ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- catch_ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC);
+ catch_ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC);
- CACHE_PTR(opline->op1.literal->cache_slot, catch_ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), catch_ce);
}
ce = zend_get_class_entry(EG(exception) TSRMLS_CC);
@@ -7688,11 +7703,27 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op1;
- zval *expr;
+ zval *expr, *expr_ptr;
zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
- expr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ expr = expr_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
+ ZVAL_DEREF(expr);
+ }
+ if (Z_TYPE_P(expr) == opline->extended_value) {
+ ZVAL_COPY_VALUE(result, expr);
+ if (IS_TMP_VAR == IS_CONST || expr != expr_ptr) {
+ zval_opt_copy_ctor(result);
+
+ } else if (IS_TMP_VAR == IS_CV) {
+ if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
+
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!1) {
@@ -7700,7 +7731,6 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
}
-cast_again:
switch (opline->extended_value) {
case IS_NULL:
convert_to_null(result);
@@ -7738,10 +7768,6 @@ cast_again:
case IS_OBJECT:
convert_to_object(result);
break;
- case IS_REFERENCE:
- result = Z_REFVAL_P(result);
- goto cast_again;
- break;
}
CHECK_EXCEPTION();
@@ -7850,7 +7876,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
}
if (EXPECTED(zend_execute_ex == execute_ex)) {
- i_create_execute_data_from_op_array(new_op_array, return_value, 1 TSRMLS_CC);
+ i_create_execute_data_from_op_array(new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
ZEND_VM_ENTER();
} else {
zend_execute(new_op_array, return_value TSRMLS_CC);
@@ -8508,10 +8534,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
zend_class_entry *ce;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_TMP_VAR != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -8520,12 +8546,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
zval_dtor(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -8735,7 +8761,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_CONST != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -8743,7 +8769,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -8751,7 +8777,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -8918,10 +8944,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND
zend_class_entry *ce;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_TMP_VAR != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -8934,12 +8960,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -8986,20 +9012,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
zend_class_entry *ce;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -9528,7 +9554,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -9536,7 +9562,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -9544,7 +9570,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -10107,10 +10133,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
zend_class_entry *ce;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_TMP_VAR != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -10119,12 +10145,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
zval_dtor(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -10318,7 +10344,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_VAR != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -10326,7 +10352,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -10334,7 +10360,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -10503,10 +10529,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE
zend_class_entry *ce;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_TMP_VAR != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -10519,12 +10545,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -10571,20 +10597,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
zend_class_entry *ce;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -10772,10 +10798,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
zend_class_entry *ce;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_TMP_VAR != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -10784,12 +10810,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
zval_dtor(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -11021,10 +11047,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN
zend_class_entry *ce;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_TMP_VAR != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -11037,12 +11063,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -11089,20 +11115,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
zend_class_entry *ce;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -11630,7 +11656,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_CV != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -11638,7 +11664,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -11646,7 +11672,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -12667,11 +12693,27 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op1;
- zval *expr;
+ zval *expr, *expr_ptr;
zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
- expr = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ expr = expr_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
+ ZVAL_DEREF(expr);
+ }
+ if (Z_TYPE_P(expr) == opline->extended_value) {
+ ZVAL_COPY_VALUE(result, expr);
+ if (IS_VAR == IS_CONST || expr != expr_ptr) {
+ zval_opt_copy_ctor(result);
+ zval_ptr_dtor_nogc(free_op1.var);
+ } else if (IS_VAR == IS_CV) {
+ if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
+
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!0) {
@@ -12679,7 +12721,6 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
}
-cast_again:
switch (opline->extended_value) {
case IS_NULL:
convert_to_null(result);
@@ -12717,10 +12758,6 @@ cast_again:
case IS_OBJECT:
convert_to_object(result);
break;
- case IS_REFERENCE:
- result = Z_REFVAL_P(result);
- goto cast_again;
- break;
}
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
@@ -12829,7 +12866,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
}
if (EXPECTED(zend_execute_ex == execute_ex)) {
- i_create_execute_data_from_op_array(new_op_array, return_value, 1 TSRMLS_CC);
+ i_create_execute_data_from_op_array(new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
ZEND_VM_ENTER();
} else {
zend_execute(new_op_array, return_value TSRMLS_CC);
@@ -13606,7 +13643,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -13624,7 +13661,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -13645,7 +13682,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -13964,7 +14001,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -13980,7 +14017,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -13995,7 +14032,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -14053,7 +14090,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -14068,7 +14105,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -14084,7 +14121,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -14131,10 +14168,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
zend_class_entry *ce;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_VAR != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -14143,12 +14180,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -14408,7 +14445,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CONST(
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -14440,7 +14477,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -14464,7 +14501,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -14493,7 +14530,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -14522,7 +14559,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OP
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -14548,7 +14585,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCOD
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -14572,7 +14609,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
@@ -14600,7 +14637,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN
zval *property_name = opline->op2.zv;
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
} else {
zend_free_op free_op_data1, free_op_data2;
@@ -14711,7 +14748,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_CONST != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -14719,7 +14756,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -14727,7 +14764,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -14765,17 +14802,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
if (IS_VAR == IS_CONST) {
/* no function found. try a static method in class */
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
call->called_scope = ce;
} else {
@@ -14790,11 +14827,11 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
if (IS_VAR == IS_CONST &&
IS_CONST == IS_CONST &&
- CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (IS_VAR != IS_CONST &&
IS_CONST == IS_CONST &&
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce))) {
/* do nothing */
} else if (IS_CONST != IS_UNUSED) {
@@ -14812,7 +14849,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
if (ce->get_static_method) {
call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
}
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
@@ -14821,9 +14858,9 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (IS_VAR == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(function_name), call->fbc);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, call->fbc);
}
}
if (IS_CONST != IS_CONST) {
@@ -14892,9 +14929,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
zend_constant *c;
zval *retval;
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- c = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) {
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
+ } else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) {
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv));
if(!actual) {
@@ -14911,7 +14948,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
zend_error_noreturn(E_ERROR, "Undefined constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
} else {
- CACHE_PTR(opline->op2.literal->cache_slot, c);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), c);
}
retval = EX_VAR(opline->result.var);
ZVAL_DUP(retval, &c->value);
@@ -14923,26 +14960,26 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
zval *value;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- value = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ value = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
- } else if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ } else if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op1.var));
- if ((value = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce)) != NULL) {
+ if ((value = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce)) != NULL) {
ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14961,9 +14998,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
EG(scope) = old_scope;
}
if (IS_VAR == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, value);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), value);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, value);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value);
}
ZVAL_DUP(EX_VAR(opline->result.var), value);
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
@@ -15105,10 +15142,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
zend_class_entry *ce;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_VAR != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -15121,12 +15158,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -15253,7 +15290,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -15295,20 +15332,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC
zend_class_entry *ce;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -15403,7 +15440,7 @@ str_index_prop:
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
@@ -15899,7 +15936,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -15917,7 +15954,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -15938,7 +15975,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -16258,7 +16295,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -16274,7 +16311,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -16289,7 +16326,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -16348,7 +16385,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -16363,7 +16400,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -16379,7 +16416,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -16558,7 +16595,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_TMP(ZE
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -16591,7 +16628,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -16615,7 +16652,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -16644,7 +16681,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -16674,7 +16711,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCO
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -16700,7 +16737,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -16724,7 +16761,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
zval_dtor(free_op2.var);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
@@ -16752,7 +16789,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL
zend_free_op free_op2;
zval *property_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
zval_dtor(free_op2.var);
} else {
zend_free_op free_op2, free_op_data1, free_op_data2;
@@ -16864,7 +16901,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -16872,7 +16909,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -16880,7 +16917,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -16919,17 +16956,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
if (IS_VAR == IS_CONST) {
/* no function found. try a static method in class */
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
call->called_scope = ce;
} else {
@@ -16944,11 +16981,11 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
if (IS_VAR == IS_CONST &&
IS_TMP_VAR == IS_CONST &&
- CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (IS_VAR != IS_CONST &&
IS_TMP_VAR == IS_CONST &&
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce))) {
/* do nothing */
} else if (IS_TMP_VAR != IS_UNUSED) {
zend_free_op free_op2;
@@ -16966,7 +17003,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
if (ce->get_static_method) {
call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
}
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
@@ -16975,9 +17012,9 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (IS_VAR == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(function_name), call->fbc);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, call->fbc);
}
}
if (IS_TMP_VAR != IS_CONST) {
@@ -17240,7 +17277,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -17311,7 +17348,7 @@ str_index_prop:
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
@@ -17808,7 +17845,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -17826,7 +17863,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -17847,7 +17884,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -18167,7 +18204,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -18183,7 +18220,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -18198,7 +18235,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -18257,7 +18294,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -18272,7 +18309,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -18288,7 +18325,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -18336,10 +18373,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
zend_class_entry *ce;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_VAR != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -18348,12 +18385,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -18613,7 +18650,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_VAR(ZE
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -18646,7 +18683,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -18670,7 +18707,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -18699,7 +18736,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -18729,7 +18766,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCO
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -18755,7 +18792,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -18779,7 +18816,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
@@ -18807,7 +18844,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
zend_free_op free_op2;
zval *property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
} else {
zend_free_op free_op2, free_op_data1, free_op_data2;
@@ -18983,7 +19020,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_VAR != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -18991,7 +19028,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -18999,7 +19036,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -19038,17 +19075,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
if (IS_VAR == IS_CONST) {
/* no function found. try a static method in class */
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
call->called_scope = ce;
} else {
@@ -19063,11 +19100,11 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
if (IS_VAR == IS_CONST &&
IS_VAR == IS_CONST &&
- CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (IS_VAR != IS_CONST &&
IS_VAR == IS_CONST &&
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce))) {
/* do nothing */
} else if (IS_VAR != IS_UNUSED) {
zend_free_op free_op2;
@@ -19085,7 +19122,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
if (ce->get_static_method) {
call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
}
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
@@ -19094,9 +19131,9 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (IS_VAR == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(function_name), call->fbc);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, call->fbc);
}
}
if (IS_VAR != IS_CONST) {
@@ -19283,10 +19320,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
zend_class_entry *ce;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_VAR != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -19299,12 +19336,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -19431,7 +19468,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -19473,20 +19510,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
zend_class_entry *ce;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -19581,7 +19618,7 @@ str_index_prop:
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
@@ -19802,7 +19839,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -19820,7 +19857,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_UNUSED == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -19841,7 +19878,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_UNUSED == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -20149,10 +20186,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
zend_class_entry *ce;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_VAR != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -20161,12 +20198,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -20371,7 +20408,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HA
zval *property_name = NULL;
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_UNUSED == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
} else {
zend_free_op free_op_data1, free_op_data2;
@@ -20426,17 +20463,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
if (IS_VAR == IS_CONST) {
/* no function found. try a static method in class */
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
call->called_scope = ce;
} else {
@@ -20451,11 +20488,11 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
if (IS_VAR == IS_CONST &&
IS_UNUSED == IS_CONST &&
- CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (IS_VAR != IS_CONST &&
IS_UNUSED == IS_CONST &&
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce))) {
/* do nothing */
} else if (IS_UNUSED != IS_UNUSED) {
@@ -20473,7 +20510,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
if (ce->get_static_method) {
call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_UNUSED == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_UNUSED == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
}
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
@@ -20482,9 +20519,9 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (IS_VAR == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(function_name), call->fbc);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, call->fbc);
}
}
if (IS_UNUSED != IS_CONST) {
@@ -20655,10 +20692,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN
zend_class_entry *ce;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_VAR != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -20671,12 +20708,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -20723,20 +20760,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
zend_class_entry *ce;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -21225,7 +21262,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -21243,7 +21280,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -21264,7 +21301,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -21583,7 +21620,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -21599,7 +21636,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -21614,7 +21651,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -21672,7 +21709,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -21687,7 +21724,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -21703,7 +21740,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -21881,7 +21918,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CV(ZEN
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -21913,7 +21950,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -21937,7 +21974,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -21966,7 +22003,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -21995,7 +22032,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCOD
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -22021,7 +22058,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_H
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -22045,7 +22082,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
@@ -22073,7 +22110,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
zval *property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
} else {
zend_free_op free_op_data1, free_op_data2;
@@ -22246,7 +22283,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_CV != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -22254,7 +22291,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -22262,7 +22299,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -22300,17 +22337,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
if (IS_VAR == IS_CONST) {
/* no function found. try a static method in class */
- if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
call->called_scope = ce;
} else {
@@ -22325,11 +22362,11 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
if (IS_VAR == IS_CONST &&
IS_CV == IS_CONST &&
- CACHED_PTR(opline->op2.literal->cache_slot)) {
- call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
+ CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ call->fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if (IS_VAR != IS_CONST &&
IS_CV == IS_CONST &&
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce))) {
/* do nothing */
} else if (IS_CV != IS_UNUSED) {
@@ -22347,7 +22384,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
if (ce->get_static_method) {
call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
}
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
@@ -22356,9 +22393,9 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (IS_VAR == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
+ CACHE_PTR(Z_CACHE_SLOT_P(function_name), call->fbc);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, call->fbc);
}
}
if (IS_CV != IS_CONST) {
@@ -22620,7 +22657,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -22691,7 +22728,7 @@ str_index_prop:
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
@@ -22991,7 +23028,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -23009,7 +23046,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -23030,7 +23067,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -23348,7 +23385,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incde
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -23364,7 +23401,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incde
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -23379,7 +23416,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incde
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -23437,7 +23474,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -23452,7 +23489,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -23468,7 +23505,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -23512,7 +23549,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CON
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -23544,7 +23581,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -23568,7 +23605,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCOD
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -23597,7 +23634,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCOD
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -23626,7 +23663,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CONST_HANDLER(ZEND
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -23652,7 +23689,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CONST_HANDLER(ZEND_OP
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -23676,7 +23713,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
/* assign_obj has two opcodes! */
@@ -23750,7 +23787,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_CONST != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -23758,7 +23795,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -23766,7 +23803,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -23801,9 +23838,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
zend_constant *c;
zval *retval;
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- c = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) {
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
+ } else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) {
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv));
if(!actual) {
@@ -23820,7 +23857,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
zend_error_noreturn(E_ERROR, "Undefined constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
} else {
- CACHE_PTR(opline->op2.literal->cache_slot, c);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), c);
}
retval = EX_VAR(opline->result.var);
ZVAL_DUP(retval, &c->value);
@@ -23832,26 +23869,26 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
zval *value;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- value = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ value = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
- } else if (CACHED_PTR(opline->op1.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op1.literal->cache_slot);
+ } else if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
}
- CACHE_PTR(opline->op1.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op1.var));
- if ((value = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce)) != NULL) {
+ if ((value = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce)) != NULL) {
ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -23870,9 +23907,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
EG(scope) = old_scope;
}
if (IS_UNUSED == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, value);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), value);
} else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, value);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value);
}
ZVAL_DUP(EX_VAR(opline->result.var), value);
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
@@ -24013,7 +24050,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -24084,7 +24121,7 @@ str_index_prop:
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
@@ -24303,7 +24340,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -24321,7 +24358,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -24342,7 +24379,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -24661,7 +24698,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -24677,7 +24714,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -24692,7 +24729,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -24751,7 +24788,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -24766,7 +24803,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -24782,7 +24819,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -24827,7 +24864,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -24860,7 +24897,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_H
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -24884,7 +24921,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -24913,7 +24950,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -24943,7 +24980,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_TMP_HANDLER(ZEND_O
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -24969,7 +25006,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCO
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -24993,7 +25030,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HA
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
zval_dtor(free_op2.var);
/* assign_obj has two opcodes! */
@@ -25073,7 +25110,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -25081,7 +25118,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -25089,7 +25126,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -25241,7 +25278,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -25312,7 +25349,7 @@ str_index_prop:
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
@@ -25532,7 +25569,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -25550,7 +25587,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -25571,7 +25608,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -25890,7 +25927,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -25906,7 +25943,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -25921,7 +25958,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -25980,7 +26017,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -25995,7 +26032,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -26011,7 +26048,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -26056,7 +26093,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -26089,7 +26126,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_H
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -26113,7 +26150,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -26142,7 +26179,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -26172,7 +26209,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_VAR_HANDLER(ZEND_O
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -26198,7 +26235,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCO
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -26222,7 +26259,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HA
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
/* assign_obj has two opcodes! */
@@ -26302,7 +26339,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_VAR != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -26310,7 +26347,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -26318,7 +26355,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -26470,7 +26507,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -26541,7 +26578,7 @@ str_index_prop:
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
@@ -26761,7 +26798,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -26779,7 +26816,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_UNUSED == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -26800,7 +26837,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_UNUSED == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -27257,7 +27294,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -27275,7 +27312,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -27296,7 +27333,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -27614,7 +27651,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -27630,7 +27667,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -27645,7 +27682,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -27703,7 +27740,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -27718,7 +27755,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -27734,7 +27771,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -27778,7 +27815,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -27810,7 +27847,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HA
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -27834,7 +27871,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_H
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -27863,7 +27900,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_H
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -27892,7 +27929,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CV_HANDLER(ZEND_OP
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -27918,7 +27955,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV_HANDLER(ZEND_OPCOD
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -27942,7 +27979,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAN
if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
/* assign_obj has two opcodes! */
@@ -28021,7 +28058,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_CV != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -28029,7 +28066,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -28037,7 +28074,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -28188,7 +28225,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -28259,7 +28296,7 @@ str_index_prop:
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
@@ -29176,11 +29213,27 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *expr;
+ zval *expr, *expr_ptr;
zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
- expr = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ expr = expr_ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR || IS_CV == IS_CV) {
+ ZVAL_DEREF(expr);
+ }
+ if (Z_TYPE_P(expr) == opline->extended_value) {
+ ZVAL_COPY_VALUE(result, expr);
+ if (IS_CV == IS_CONST || expr != expr_ptr) {
+ zval_opt_copy_ctor(result);
+
+ } else if (IS_CV == IS_CV) {
+ if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
+
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!0) {
@@ -29188,7 +29241,6 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
}
-cast_again:
switch (opline->extended_value) {
case IS_NULL:
convert_to_null(result);
@@ -29226,10 +29278,6 @@ cast_again:
case IS_OBJECT:
convert_to_object(result);
break;
- case IS_REFERENCE:
- result = Z_REFVAL_P(result);
- goto cast_again;
- break;
}
CHECK_EXCEPTION();
@@ -29338,7 +29386,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
}
if (EXPECTED(zend_execute_ex == execute_ex)) {
- i_create_execute_data_from_op_array(new_op_array, return_value, 1 TSRMLS_CC);
+ i_create_execute_data_from_op_array(new_op_array, return_value, VM_FRAME_NESTED_CODE TSRMLS_CC);
ZEND_VM_ENTER();
} else {
zend_execute(new_op_array, return_value TSRMLS_CC);
@@ -29973,7 +30021,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -29991,7 +30039,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -30012,7 +30060,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -30330,7 +30378,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -30346,7 +30394,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -30361,7 +30409,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -30419,7 +30467,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -30434,7 +30482,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -30450,7 +30498,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -30497,10 +30545,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
zend_class_entry *ce;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CV != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -30509,12 +30557,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -30774,7 +30822,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CONST(Z
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -30806,7 +30854,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -30830,7 +30878,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -30859,7 +30907,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -30888,7 +30936,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPC
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -30914,7 +30962,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -30938,7 +30986,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
/* assign_obj has two opcodes! */
@@ -30966,7 +31014,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND
zval *property_name = opline->op2.zv;
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
} else {
zend_free_op free_op_data1, free_op_data2;
@@ -31077,7 +31125,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_CONST != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -31085,7 +31133,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -31093,7 +31141,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -31260,10 +31308,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
zend_class_entry *ce;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_CV != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -31276,12 +31324,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -31408,7 +31456,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -31450,20 +31498,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO
zend_class_entry *ce;
if (IS_CONST == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -31558,7 +31606,7 @@ str_index_prop:
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
@@ -32053,7 +32101,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -32071,7 +32119,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -32092,7 +32140,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -32411,7 +32459,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -32427,7 +32475,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -32442,7 +32490,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -32501,7 +32549,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -32516,7 +32564,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -32532,7 +32580,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -32711,7 +32759,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_TMP(ZEN
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -32744,7 +32792,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -32768,7 +32816,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -32797,7 +32845,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -32827,7 +32875,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCOD
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -32853,7 +32901,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_H
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -32877,7 +32925,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
zval_dtor(free_op2.var);
/* assign_obj has two opcodes! */
@@ -32905,7 +32953,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE
zend_free_op free_op2;
zval *property_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
zval_dtor(free_op2.var);
} else {
zend_free_op free_op2, free_op_data1, free_op_data2;
@@ -33017,7 +33065,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -33025,7 +33073,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -33033,7 +33081,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -33278,7 +33326,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -33349,7 +33397,7 @@ str_index_prop:
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_TMP_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
@@ -33845,7 +33893,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -33863,7 +33911,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -33884,7 +33932,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -34203,7 +34251,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -34219,7 +34267,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -34234,7 +34282,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -34293,7 +34341,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -34308,7 +34356,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -34324,7 +34372,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -34372,10 +34420,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
zend_class_entry *ce;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CV != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -34384,12 +34432,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -34649,7 +34697,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_VAR(ZEN
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -34682,7 +34730,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -34706,7 +34754,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -34735,7 +34783,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -34765,7 +34813,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCOD
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -34791,7 +34839,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_H
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -34815,7 +34863,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
/* assign_obj has two opcodes! */
@@ -34843,7 +34891,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
zend_free_op free_op2;
zval *property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
} else {
zend_free_op free_op2, free_op_data1, free_op_data2;
@@ -35018,7 +35066,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_VAR != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -35026,7 +35074,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -35034,7 +35082,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -35203,10 +35251,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
zend_class_entry *ce;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_CV != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -35219,12 +35267,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -35351,7 +35399,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -35393,20 +35441,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
zend_class_entry *ce;
if (IS_VAR == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -35501,7 +35549,7 @@ str_index_prop:
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_VAR == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
@@ -35721,7 +35769,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -35739,7 +35787,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_UNUSED == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -35760,7 +35808,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_UNUSED == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -36067,10 +36115,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
zend_class_entry *ce;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CV != IS_CONST) {
zval_dtor(&tmp_varname);
@@ -36079,12 +36127,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -36289,7 +36337,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAN
zval *property_name = NULL;
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_UNUSED == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
} else {
zend_free_op free_op_data1, free_op_data2;
@@ -36459,10 +36507,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND
zend_class_entry *ce;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_CV != IS_CONST && tmp_is_dup) {
zval_dtor(&tmp);
@@ -36475,12 +36523,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND
if (UNEXPECTED(ce == NULL)) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
@@ -36527,20 +36575,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
zend_class_entry *ce;
if (IS_UNUSED == IS_CONST) {
- if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- ce = CACHED_PTR(opline->op2.literal->cache_slot);
+ if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
+ ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else {
- ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- CACHE_PTR(opline->op2.literal->cache_slot, ce);
+ CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
}
} else {
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(varname) : -1) TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -37010,7 +37058,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
/* here we are sure we are dealing with an object */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -37028,7 +37076,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
if (Z_OBJ_HT_P(object)->read_property) {
- z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
}
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
if (Z_OBJ_HT_P(object)->read_dimension) {
@@ -37049,7 +37097,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ {
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
@@ -37367,7 +37415,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t inc
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -37383,7 +37431,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t inc
zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval rv;
@@ -37398,7 +37446,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t inc
SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
ZVAL_COPY_VALUE(retval, z);
- Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(retval, opline);
zval_ptr_dtor(z);
} else {
@@ -37456,7 +37504,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
/* here we are sure we are dealing with an object */
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
@@ -37471,7 +37519,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval rv;
- zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), &rv TSRMLS_CC);
+ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), &rv TSRMLS_CC);
zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
@@ -37487,7 +37535,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
ZVAL_DUP(&z_copy, z);
incdec_op(&z_copy);
if (Z_REFCOUNTED_P(z)) Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
} else {
@@ -37665,7 +37713,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CV(ZEND
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -37697,7 +37745,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -37721,7 +37769,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_RW, 0 TSRMLS_CC);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -37750,7 +37798,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
zval *retval;
/* here we are sure we are dealing with an object */
- retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1), EX_VAR(opline->result.var) TSRMLS_CC);
if (retval != EX_VAR(opline->result.var)) {
ZVAL_COPY(EX_VAR(opline->result.var), retval);
@@ -37779,7 +37827,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_W, 0 TSRMLS_CC);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -37805,7 +37853,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HA
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property) : -1), BP_VAR_UNSET, 0 TSRMLS_CC);
if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
@@ -37829,7 +37877,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
/* assign_obj has two opcodes! */
@@ -37857,7 +37905,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
zval *property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(property_name) : -1) TSRMLS_CC);
} else {
zend_free_op free_op_data1, free_op_data2;
@@ -38029,7 +38077,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
call->called_scope = zend_get_class_entry(call->object TSRMLS_CC);
if (IS_CV != IS_CONST ||
- (call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
+ (call->fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope)) == NULL) {
zend_object *object = call->object;
if (UNEXPECTED(object->handlers->get_method == NULL)) {
@@ -38037,7 +38085,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
}
/* First, locate the function. */
- call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = object->handlers->get_method(&call->object, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_P(function_name));
}
@@ -38045,7 +38093,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(call->object == object)) {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), call->called_scope, call->fbc);
}
}
} else {
@@ -38288,7 +38336,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DEREF(container);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
@@ -38359,7 +38407,7 @@ str_index_prop:
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
- result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CV == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl
index e017abbce6..fa976cb678 100644
--- a/Zend/zend_vm_execute.skl
+++ b/Zend/zend_vm_execute.skl
@@ -36,7 +36,7 @@ ZEND_API void zend_{%EXECUTOR_NAME%}(zend_op_array *op_array, zval *return_value
if (EG(exception) != NULL) {
return;
}
- zend_{%EXECUTOR_NAME%}_ex(i_create_execute_data_from_op_array(op_array, return_value, 0 TSRMLS_CC) TSRMLS_CC);
+ zend_{%EXECUTOR_NAME%}_ex(i_create_execute_data_from_op_array(op_array, return_value, EG(active_symbol_table) ? VM_FRAME_TOP_CODE : VM_FRAME_TOP_FUNCTION TSRMLS_CC) TSRMLS_CC);
}
{%EXTERNAL_EXECUTOR%}
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php
index 5614052520..03d660e2f9 100644
--- a/Zend/zend_vm_gen.php
+++ b/Zend/zend_vm_gen.php
@@ -942,7 +942,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
out($f,"#define LOAD_REGS()\n");
out($f,"#define ZEND_VM_CONTINUE() goto zend_vm_continue\n");
out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n");
- out($f,"#define ZEND_VM_ENTER() ZEND_VM_CONTINUE()\n");
+ out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
out($f,"#define ZEND_VM_DISPATCH(opcode, opline) dispatch_handler = zend_vm_get_opcode_handler(opcode, opline); goto zend_vm_dispatch;\n\n");
out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n");
@@ -974,7 +974,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
out($f,"#define LOAD_REGS()\n");
out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(OPLINE->handler)\n");
out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n");
- out($f,"#define ZEND_VM_ENTER() ZEND_VM_CONTINUE()\n");
+ out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
out($f,"#define ZEND_VM_DISPATCH(opcode, opline) goto *(void**)(zend_vm_get_opcode_handler(opcode, opline));\n\n");
out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n");
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 634f08afa7..06c131014e 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -633,10 +633,10 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC);
static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC);
static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n TSRMLS_DC);
-zval *date_interval_read_property(zval *object, zval *member, int type, const zend_literal *key, zval *rv TSRMLS_DC);
-void date_interval_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC);
-static zval *date_period_read_property(zval *object, zval *member, int type, const zend_literal *key, zval *rv TSRMLS_DC);
-static void date_period_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC);
+zval *date_interval_read_property(zval *object, zval *member, int type, zend_uint cache_slot, zval *rv TSRMLS_DC);
+void date_interval_write_property(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC);
+static zval *date_period_read_property(zval *object, zval *member, int type, zend_uint cache_slot, zval *rv TSRMLS_DC);
+static void date_period_write_property(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC);
/* {{{ Module struct */
zend_module_entry date_module_entry = {
@@ -3947,7 +3947,7 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
} /* }}} */
/* {{{ date_interval_read_property */
-zval *date_interval_read_property(zval *object, zval *member, int type, const zend_literal *key, zval *rv TSRMLS_DC)
+zval *date_interval_read_property(zval *object, zval *member, int type, zend_uint cache_slot, zval *rv TSRMLS_DC)
{
php_interval_obj *obj;
zval *retval;
@@ -3959,13 +3959,13 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze
zval_copy_ctor(&tmp_member);
convert_to_string(&tmp_member);
member = &tmp_member;
- key = NULL;
+ cache_slot = -1;
}
obj = Z_PHPINTERVAL_P(object);
if (!obj->initialized) {
- retval = (zend_get_std_object_handlers())->read_property(object, member, type, key, rv TSRMLS_CC);
+ retval = (zend_get_std_object_handlers())->read_property(object, member, type, cache_slot, rv TSRMLS_CC);
if (member == &tmp_member) {
zval_dtor(member);
}
@@ -3987,7 +3987,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze
GET_VALUE_FROM_STRUCT(invert, "invert");
GET_VALUE_FROM_STRUCT(days, "days");
/* didn't find any */
- retval = (zend_get_std_object_handlers())->read_property(object, member, type, key, rv TSRMLS_CC);
+ retval = (zend_get_std_object_handlers())->read_property(object, member, type, cache_slot, rv TSRMLS_CC);
if (member == &tmp_member) {
zval_dtor(member);
@@ -4013,7 +4013,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze
/* }}} */
/* {{{ date_interval_write_property */
-void date_interval_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC)
+void date_interval_write_property(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC)
{
php_interval_obj *obj;
zval tmp_member, tmp_value;
@@ -4023,13 +4023,13 @@ void date_interval_write_property(zval *object, zval *member, zval *value, const
zval_copy_ctor(&tmp_member);
convert_to_string(&tmp_member);
member = &tmp_member;
- key = NULL;
+ cache_slot = -1;
}
obj = Z_PHPINTERVAL_P(object);
if (!obj->initialized) {
- (zend_get_std_object_handlers())->write_property(object, member, value, key TSRMLS_CC);
+ (zend_get_std_object_handlers())->write_property(object, member, value, cache_slot TSRMLS_CC);
if (member == &tmp_member) {
zval_dtor(member);
}
@@ -4051,7 +4051,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, const
SET_VALUE_FROM_STRUCT(s, "s");
SET_VALUE_FROM_STRUCT(invert, "invert");
/* didn't find any */
- (zend_get_std_object_handlers())->write_property(object, member, value, key TSRMLS_CC);
+ (zend_get_std_object_handlers())->write_property(object, member, value, cache_slot TSRMLS_CC);
} while(0);
if (member == &tmp_member) {
@@ -4930,7 +4930,7 @@ PHP_METHOD(DatePeriod, __wakeup)
/* }}} */
/* {{{ date_period_read_property */
-static zval *date_period_read_property(zval *object, zval *member, int type, const zend_literal *key, zval *rv TSRMLS_DC)
+static zval *date_period_read_property(zval *object, zval *member, int type, zend_uint cache_slot, zval *rv TSRMLS_DC)
{
zval *zv;
if (type != BP_VAR_IS && type != BP_VAR_R) {
@@ -4939,7 +4939,7 @@ static zval *date_period_read_property(zval *object, zval *member, int type, con
Z_OBJPROP_P(object); /* build properties hash table */
- zv = std_object_handlers.read_property(object, member, type, key, rv TSRMLS_CC);
+ zv = std_object_handlers.read_property(object, member, type, cache_slot, rv TSRMLS_CC);
if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJ_HANDLER_P(zv, clone_obj)) {
/* defensive copy */
//??? MAKE_STD_ZVAL(zv);
@@ -4951,7 +4951,7 @@ static zval *date_period_read_property(zval *object, zval *member, int type, con
/* }}} */
/* {{{ date_period_write_property */
-static void date_period_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC)
+static void date_period_write_property(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC)
{
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Writing to DatePeriod properties is unsupported");
}
diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c
index 250e2efab5..22d0ab0ee3 100644
--- a/ext/dom/dom_iterators.c
+++ b/ext/dom/dom_iterators.c
@@ -197,10 +197,7 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
if (objmap->nodetype != XML_ENTITY_NODE &&
objmap->nodetype != XML_NOTATION_NODE) {
if (objmap->nodetype == DOM_NODESET) {
- zval obj;
- ZVAL_OBJ(&obj, &objmap->baseobj->std);
- nodeht = HASH_OF(&obj);
-
+ nodeht = HASH_OF(&objmap->baseobj_zv);
zend_hash_move_forward(nodeht);
if ((entry = zend_hash_get_current_data(nodeht))) {
ZVAL_COPY(&iterator->curobj, entry);
@@ -275,10 +272,7 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, i
if (objmap->nodetype != XML_ENTITY_NODE &&
objmap->nodetype != XML_NOTATION_NODE) {
if (objmap->nodetype == DOM_NODESET) {
- zval obj;
- ZVAL_OBJ(&obj, &objmap->baseobj->std);
- nodeht = HASH_OF(&obj);
-
+ nodeht = HASH_OF(&objmap->baseobj_zv);
zend_hash_internal_pointer_reset(nodeht);
if ((entry = zend_hash_get_current_data(nodeht))) {
ZVAL_COPY(&iterator->curobj, entry);
diff --git a/ext/dom/node.c b/ext/dom/node.c
index 920581423e..57669b5069 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -1729,8 +1729,8 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
zend_string *prefix;
ulong idx;
- if (zend_hash_get_current_key_ex(Z_ARRVAL_P(tmp),
- &prefix, &idx, 0, NULL) == HASH_KEY_IS_STRING) {
+ if (zend_hash_get_current_key(Z_ARRVAL_P(tmp),
+ &prefix, &idx, 0) == HASH_KEY_IS_STRING) {
xmlXPathRegisterNs(ctxp, prefix->val, Z_STRVAL_P(tmpns));
}
}
diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c
index 323eb9925d..3ef43f2ac7 100644
--- a/ext/dom/nodelist.c
+++ b/ext/dom/nodelist.c
@@ -64,9 +64,7 @@ int dom_nodelist_length_read(dom_object *obj, zval *retval TSRMLS_DC)
count = xmlHashSize(objmap->ht);
} else {
if (objmap->nodetype == DOM_NODESET) {
- zval obj;
- ZVAL_OBJ(&obj, &objmap->baseobj->std);
- nodeht = HASH_OF(&obj);
+ nodeht = HASH_OF(&objmap->baseobj_zv);
count = zend_hash_num_elements(nodeht);
} else {
nodep = dom_object_get_node(objmap->baseobj);
@@ -132,9 +130,7 @@ PHP_FUNCTION(dom_nodelist_item)
}
} else {
if (objmap->nodetype == DOM_NODESET) {
- zval obj;
- ZVAL_OBJ(&obj, &objmap->baseobj->std);
- HashTable *nodeht = HASH_OF(&obj);
+ HashTable *nodeht = HASH_OF(&objmap->baseobj_zv);
zval *entry = zend_hash_index_find(nodeht, index);
if (entry) {
ZVAL_COPY(return_value, entry);
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 538317295d..99d99e236f 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -73,6 +73,9 @@ zend_class_entry *dom_namespace_node_class_entry;
zend_object_handlers dom_object_handlers;
zend_object_handlers dom_nnodemap_object_handlers;
+#if defined(LIBXML_XPATH_ENABLED)
+zend_object_handlers dom_xpath_object_handlers;
+#endif
static HashTable classes;
/* {{{ prop handler tables */
@@ -108,6 +111,10 @@ typedef struct _dom_prop_handler {
dom_write_t write_func;
} dom_prop_handler;
+static zend_object_handlers* dom_get_obj_handlers(TSRMLS_D) {
+ return &dom_object_handlers;
+}
+
/* {{{ int dom_node_is_read_only(xmlNodePtr node) */
int dom_node_is_read_only(xmlNodePtr node) {
switch (node->type) {
@@ -303,7 +310,7 @@ static void dom_register_prop_handler(HashTable *prop_handler, char *name, dom_r
}
/* }}} */
-static zval *dom_get_property_ptr_ptr(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */
+static zval *dom_get_property_ptr_ptr(zval *object, zval *member, int type, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
dom_object *obj = Z_DOMOBJ_P(object);
zend_string *member_str = zval_get_string(member TSRMLS_CC);
@@ -311,7 +318,7 @@ static zval *dom_get_property_ptr_ptr(zval *object, zval *member, int type, cons
if (!obj->prop_handler || !zend_hash_exists(obj->prop_handler, member_str)) {
zend_object_handlers *std_hnd = zend_get_std_object_handlers();
- retval = std_hnd->get_property_ptr_ptr(object, member, type, key TSRMLS_CC);
+ retval = std_hnd->get_property_ptr_ptr(object, member, type, cache_slot TSRMLS_CC);
}
STR_RELEASE(member_str);
@@ -320,7 +327,7 @@ static zval *dom_get_property_ptr_ptr(zval *object, zval *member, int type, cons
/* }}} */
/* {{{ dom_read_property */
-zval *dom_read_property(zval *object, zval *member, int type, const zend_literal *key, zval *rv TSRMLS_DC)
+zval *dom_read_property(zval *object, zval *member, int type, zend_uint cache_slot, zval *rv TSRMLS_DC)
{
dom_object *obj = Z_DOMOBJ_P(object);
zend_string *member_str = zval_get_string(member TSRMLS_CC);
@@ -342,7 +349,7 @@ zval *dom_read_property(zval *object, zval *member, int type, const zend_literal
}
} else {
zend_object_handlers *std_hnd = zend_get_std_object_handlers();
- retval = std_hnd->read_property(object, member, type, key, rv TSRMLS_CC);
+ retval = std_hnd->read_property(object, member, type, cache_slot, rv TSRMLS_CC);
}
STR_RELEASE(member_str);
@@ -351,7 +358,7 @@ zval *dom_read_property(zval *object, zval *member, int type, const zend_literal
/* }}} */
/* {{{ dom_write_property */
-void dom_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC)
+void dom_write_property(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC)
{
dom_object *obj = Z_DOMOBJ_P(object);
zend_string *member_str = zval_get_string(member TSRMLS_CC);
@@ -364,7 +371,7 @@ void dom_write_property(zval *object, zval *member, zval *value, const zend_lite
hnd->write_func(obj, value TSRMLS_CC);
} else {
zend_object_handlers *std_hnd = zend_get_std_object_handlers();
- std_hnd->write_property(object, member, value, key TSRMLS_CC);
+ std_hnd->write_property(object, member, value, cache_slot TSRMLS_CC);
}
STR_RELEASE(member_str);
@@ -372,7 +379,7 @@ void dom_write_property(zval *object, zval *member, zval *value, const zend_lite
/* }}} */
/* {{{ dom_property_exists */
-static int dom_property_exists(zval *object, zval *member, int check_empty, const zend_literal *key TSRMLS_DC)
+static int dom_property_exists(zval *object, zval *member, int check_empty, zend_uint cache_slot TSRMLS_DC)
{
dom_object *obj = Z_DOMOBJ_P(object);
zend_string *member_str = zval_get_string(member TSRMLS_CC);
@@ -397,7 +404,7 @@ static int dom_property_exists(zval *object, zval *member, int check_empty, cons
}
} else {
zend_object_handlers *std_hnd = zend_get_std_object_handlers();
- retval = std_hnd->has_property(object, member, check_empty, key TSRMLS_CC);
+ retval = std_hnd->has_property(object, member, check_empty, cache_slot TSRMLS_CC);
}
STR_RELEASE(member_str);
@@ -430,7 +437,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp TSRMLS_DC
ZVAL_STRING(&object_value, "(object value omitted)");
for (zend_hash_internal_pointer_reset_ex(prop_handlers, &pos);
- entry = zend_hash_get_current_data_ptr_ex(prop_handlers, &pos);
+ (entry = zend_hash_get_current_data_ptr_ex(prop_handlers, &pos)) != NULL;
zend_hash_move_forward_ex(prop_handlers, &pos)) {
zval value;
zend_string *string_key;
@@ -470,7 +477,7 @@ void *php_dom_export_node(zval *object TSRMLS_DC) /* {{{ */
php_libxml_node_object *intern;
xmlNodePtr nodep = NULL;
- intern = Z_DOMOBJ_P(object);
+ intern = (php_libxml_node_object *) Z_DOMOBJ_P(object);
if (intern->node) {
nodep = intern->node->node;
}
@@ -492,7 +499,7 @@ PHP_FUNCTION(dom_import_simplexml)
return;
}
- nodeobj = Z_DOMOBJ_P(node);
+ nodeobj = (php_libxml_node_object *) ((char *) Z_OBJ_P(node) - Z_OBJ_HT_P(node)->offset);
nodep = php_libxml_import_node(node TSRMLS_CC);
if (nodep && nodeobj && (nodep->type == XML_ELEMENT_NODE || nodep->type == XML_ATTRIBUTE_NODE)) {
@@ -504,31 +511,36 @@ PHP_FUNCTION(dom_import_simplexml)
}
/* }}} */
-zend_object *dom_objects_store_clone_obj(zval *zobject TSRMLS_DC) /* {{{ */
-{
- ZEND_ASSERT(0);
- /*void *new_object;
- dom_object *intern;
- dom_object *old_object;
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
-
- obj = &EG(objects_store).object_buckets[handle].bucket.obj;
+static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool hash_copy TSRMLS_DC);
- if (obj->clone == NULL) {
- php_error(E_ERROR, "Trying to clone an uncloneable object of class %s", Z_OBJCE_P(zobject)->name);
- }
+static zend_object *dom_objects_store_clone_obj(zval *zobject TSRMLS_DC) /* {{{ */
+{
+ dom_object *intern = Z_DOMOBJ_P(zobject);
+ dom_object *clone = dom_objects_set_class(intern->std.ce, 0 TSRMLS_CC);
- obj->clone(obj->object, &new_object TSRMLS_CC);
+ clone->std.handlers = dom_get_obj_handlers(TSRMLS_C);
+ zend_objects_clone_members(&clone->std, &intern->std TSRMLS_CC);
- retval.handle = zend_objects_store_put(new_object, obj->dtor, obj->free_storage, obj->clone TSRMLS_CC);
- intern = (dom_object *) new_object;
- intern->handle = retval.handle;
- retval.handlers = Z_OBJ_HT_P(zobject);
+ if (instanceof_function(intern->std.ce, dom_node_class_entry TSRMLS_CC)) {
+ xmlNodePtr node = (xmlNodePtr)dom_object_get_node(intern);
+ if (node != NULL) {
+ xmlNodePtr cloned_node = xmlDocCopyNode(node, node->doc, 1);
+ if (cloned_node != NULL) {
+ /* If we cloned a document then we must create new doc proxy */
+ if (cloned_node->doc == node->doc) {
+ clone->document = intern->document;
+ }
+ php_libxml_increment_doc_ref((php_libxml_node_object *)clone, cloned_node->doc TSRMLS_CC);
+ php_libxml_increment_node_ptr((php_libxml_node_object *)clone, cloned_node, (void *)clone TSRMLS_CC);
+ if (intern->document != clone->document) {
+ dom_copy_doc_props(intern->document, clone->document);
+ }
+ }
- old_object = (dom_object *) obj->object;
- zend_objects_clone_members(&intern->std, retval, &old_object->std, intern->handle TSRMLS_CC);
+ }
+ }
- return retval;*/
+ return &clone->std;
}
/* }}} */
@@ -556,10 +568,6 @@ static const zend_function_entry dom_functions[] = {
PHP_FE_END
};
-static zend_object_handlers* dom_get_obj_handlers(TSRMLS_D) {
- return &dom_object_handlers;
-}
-
static const zend_module_dep dom_deps[] = {
ZEND_MOD_REQUIRED("libxml")
ZEND_MOD_CONFLICTS("domxml")
@@ -587,7 +595,11 @@ ZEND_GET_MODULE(dom)
void dom_objects_free_storage(zend_object *object TSRMLS_DC);
void dom_nnodemap_objects_free_storage(zend_object *object TSRMLS_DC);
+static zend_object *dom_objects_store_clone_obj(zval *zobject TSRMLS_DC);
static void dom_nnodemap_object_dtor(zend_object *object TSRMLS_DC);
+#if defined(LIBXML_XPATH_ENABLED)
+void dom_xpath_objects_free_storage(zend_object *object TSRMLS_DC);
+#endif
/* {{{ PHP_MINIT_FUNCTION(dom) */
PHP_MINIT_FUNCTION(dom)
@@ -597,6 +609,7 @@ PHP_MINIT_FUNCTION(dom)
memcpy(&dom_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
dom_object_handlers.offset = XtOffsetOf(dom_object, std);
dom_object_handlers.free_obj = dom_objects_free_storage;
+ dom_object_handlers.clone_obj = dom_objects_store_clone_obj;
dom_object_handlers.read_property = dom_read_property;
dom_object_handlers.write_property = dom_write_property;
dom_object_handlers.get_property_ptr_ptr = dom_get_property_ptr_ptr;
@@ -835,6 +848,10 @@ PHP_MINIT_FUNCTION(dom)
REGISTER_DOM_CLASS(ce, "DOMStringExtend", NULL, php_dom_string_extend_class_functions, dom_string_extend_class_entry);
#if defined(LIBXML_XPATH_ENABLED)
+ memcpy(&dom_xpath_object_handlers, &dom_object_handlers, sizeof(zend_object_handlers));
+ dom_xpath_object_handlers.offset = XtOffsetOf(dom_xpath_object, dom) + XtOffsetOf(dom_object, std);
+ dom_xpath_object_handlers.free_obj = dom_xpath_objects_free_storage;
+
INIT_CLASS_ENTRY(ce, "DOMXPath", php_dom_xpath_class_functions);
ce.create_object = dom_xpath_objects_new;
dom_xpath_class_entry = zend_register_internal_class_ex(&ce, NULL TSRMLS_CC);
@@ -997,16 +1014,15 @@ void node_list_unlink(xmlNodePtr node TSRMLS_DC)
#if defined(LIBXML_XPATH_ENABLED)
/* {{{ dom_xpath_objects_free_storage */
-void dom_xpath_objects_free_storage(void *object TSRMLS_DC)
+void dom_xpath_objects_free_storage(zend_object *object TSRMLS_DC)
{
- dom_xpath_object *intern = (dom_xpath_object *)object;
+ dom_xpath_object *intern = php_xpath_obj_from_obj(object);
- zend_object_std_dtor(&intern->std TSRMLS_CC);
+ zend_object_std_dtor(&intern->dom.std TSRMLS_CC);
- if (intern->ptr != NULL) {
- xmlXPathFreeContext((xmlXPathContextPtr) intern->ptr);
- php_libxml_decrement_doc_ref((php_libxml_node_object *) intern TSRMLS_CC);
- intern->ptr = NULL;
+ if (intern->dom.ptr != NULL) {
+ xmlXPathFreeContext((xmlXPathContextPtr) intern->dom.ptr);
+ php_libxml_decrement_doc_ref((php_libxml_node_object *) &intern->dom TSRMLS_CC);
}
if (intern->registered_phpfunctions) {
@@ -1018,8 +1034,6 @@ void dom_xpath_objects_free_storage(void *object TSRMLS_DC)
zend_hash_destroy(intern->node_list);
FREE_HASHTABLE(intern->node_list);
}
-
- efree(object);
}
/* }}} */
#endif
@@ -1052,9 +1066,9 @@ void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xml
{
dom_nnodemap_object *mapptr = (dom_nnodemap_object *) intern->ptr;
- if (basenode) {
- GC_REFCOUNT(&basenode->std)++;
- }
+ //??? if (basenode)
+ ZVAL_OBJ(&mapptr->baseobj_zv, &basenode->std);
+ Z_ADDREF(mapptr->baseobj_zv);
mapptr->baseobj = basenode;
mapptr->nodetype = ntype;
@@ -1066,12 +1080,9 @@ void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xml
static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool hash_copy TSRMLS_DC) /* {{{ */
{
- zend_class_entry *base_class;
- size_t dom_object_size = instanceof_function(class_type, dom_xpath_class_entry TSRMLS_CC)
- ? sizeof(dom_xpath_object) : sizeof(dom_object);
- dom_object *intern = ecalloc(1, dom_object_size + sizeof(zval) * (class_type->default_properties_count - 1));
+ dom_object *intern = ecalloc(1, sizeof(dom_object) + sizeof(zval) * (class_type->default_properties_count - 1));
- base_class = class_type;
+ zend_class_entry *base_class = class_type;
while (base_class->type != ZEND_INTERNAL_CLASS && base_class->parent != NULL) {
base_class = base_class->parent;
}
@@ -1087,39 +1098,6 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool
}
/* }}} */
-/* {{{ dom_objects_clone */
-void dom_objects_clone(void *object, void **object_clone TSRMLS_DC)
-{
- dom_object *intern = (dom_object *) object;
- dom_object *clone;
- xmlNodePtr node;
- xmlNodePtr cloned_node;
-
- clone = dom_objects_set_class(intern->std.ce, 0 TSRMLS_CC);
-
- if (instanceof_function(intern->std.ce, dom_node_class_entry TSRMLS_CC)) {
- node = (xmlNodePtr)dom_object_get_node((dom_object *) object);
- if (node != NULL) {
- cloned_node = xmlDocCopyNode(node, node->doc, 1);
- if (cloned_node != NULL) {
- /* If we cloned a document then we must create new doc proxy */
- if (cloned_node->doc == node->doc) {
- clone->document = intern->document;
- }
- php_libxml_increment_doc_ref((php_libxml_node_object *)clone, cloned_node->doc TSRMLS_CC);
- php_libxml_increment_node_ptr((php_libxml_node_object *)clone, cloned_node, (void *)clone TSRMLS_CC);
- if (intern->document != clone->document) {
- dom_copy_doc_props(intern->document, clone->document);
- }
- }
-
- }
- }
-
- *object_clone = (void *) clone;
-}
-/* }}} */
-
/* {{{ dom_objects_new */
zend_object *dom_objects_new(zend_class_entry *class_type TSRMLS_DC)
{
@@ -1133,16 +1111,18 @@ zend_object *dom_objects_new(zend_class_entry *class_type TSRMLS_DC)
/* {{{ zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC) */
zend_object *dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC)
{
- dom_xpath_object *intern = (dom_xpath_object *) dom_objects_set_class(class_type, 1 TSRMLS_CC);
- intern->registerPhpFunctions = 0;
- intern->node_list = NULL;
+ dom_xpath_object *intern = ecalloc(1, sizeof(dom_xpath_object) + sizeof(zval) * (class_type->default_properties_count - 1));
ALLOC_HASHTABLE(intern->registered_phpfunctions);
zend_hash_init(intern->registered_phpfunctions, 0, NULL, ZVAL_PTR_DTOR, 0);
- intern->std.handlers = dom_get_obj_handlers(TSRMLS_C);
+ intern->dom.prop_handler = &dom_xpath_prop_handlers;
+ intern->dom.std.handlers = &dom_xpath_object_handlers;
- return &intern->std;
+ zend_object_std_init(&intern->dom.std, class_type TSRMLS_CC);
+ object_properties_init(&intern->dom.std, class_type);
+
+ return &intern->dom.std;
}
/* }}} */
#endif
@@ -1162,8 +1142,8 @@ static void dom_nnodemap_object_dtor(zend_object *object TSRMLS_DC) /* {{{ */
if (objmap->ns) {
xmlFree(objmap->ns);
}
- if (objmap->baseobj) {
- OBJ_RELEASE(&objmap->baseobj->std);
+ if (!ZVAL_IS_UNDEF(&objmap->baseobj_zv)) {
+ zval_ptr_dtor(&objmap->baseobj_zv);
}
efree(objmap);
intern->ptr = NULL;
@@ -1189,6 +1169,7 @@ zend_object *dom_nnodemap_objects_new(zend_class_entry *class_type TSRMLS_DC) /*
intern = dom_objects_set_class(class_type, 1 TSRMLS_CC);
intern->ptr = emalloc(sizeof(dom_nnodemap_object));
objmap = (dom_nnodemap_object *)intern->ptr;
+ ZVAL_UNDEF(&objmap->baseobj_zv);
objmap->baseobj = NULL;
objmap->nodetype = 0;
objmap->ht = NULL;
diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h
index 8f6eba12c0..628a19e978 100644
--- a/ext/dom/php_dom.h
+++ b/ext/dom/php_dom.h
@@ -68,18 +68,22 @@ extern zend_module_entry dom_module_entry;
#define DOM_NODESET XML_XINCLUDE_START
typedef struct _dom_xpath_object {
- zend_object std;
- void *ptr;
- php_libxml_ref_obj *document;
- HashTable *prop_handler;
- //??? zend_object_handle handle;
int registerPhpFunctions;
HashTable *registered_phpfunctions;
HashTable *node_list;
+ dom_object dom;
} dom_xpath_object;
+static inline dom_xpath_object *php_xpath_obj_from_obj(zend_object *obj) {
+ return (dom_xpath_object*)((char*)(obj)
+ - XtOffsetOf(dom_xpath_object, dom) - XtOffsetOf(dom_object, std));
+}
+
+#define Z_XPATHOBJ_P(zv) php_xpath_obj_from_obj(Z_OBJ_P((zv)))
+
typedef struct _dom_nnodemap_object {
dom_object *baseobj;
+ zval baseobj_zv;
int nodetype;
xmlHashTable *ht;
xmlChar *local;
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index 21998704fe..08bb8603a5 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -159,7 +159,7 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs,
node->parent = nsparent;
node->ns = curns;
}
- php_dom_create_object(node, &child, (dom_object *)intern TSRMLS_CC);
+ php_dom_create_object(node, &child, &intern->dom TSRMLS_CC);
add_next_index_zval(&fci.params[i], &child);
}
}
@@ -196,7 +196,6 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs,
if (!zend_make_callable(&fci.function_name, &callable TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", callable->val);
-
} else if (intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable) == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not allowed to call handler '%s()'.", callable->val);
/* Push an empty string, so that we at least have an xslt result... */
@@ -213,7 +212,7 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs,
}
GC_REFCOUNT(&retval)++;
zend_hash_next_index_insert(intern->node_list, &retval);
- obj = Z_DOMOBJ_P(&retval);
+ obj = Z_XPATHOBJ_P(&retval);
nodep = dom_object_get_node(obj);
valuePush(ctxt, xmlXPathNewNodeSet(nodep));
} else if (Z_TYPE(retval) == IS_BOOL) {
@@ -223,12 +222,13 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs,
valuePush(ctxt, xmlXPathNewString((xmlChar *)""));
} else {
convert_to_string_ex(&retval);
- valuePush(ctxt, xmlXPathNewString( Z_STRVAL(retval)));
+ valuePush(ctxt, xmlXPathNewString(Z_STRVAL(retval)));
}
zval_ptr_dtor(&retval);
}
}
- STR_FREE(callable);
+ STR_RELEASE(callable);
+ zval_dtor(&fci.function_name);
if (fci.param_count > 0) {
for (i = 0; i < nargs - 1; i++) {
zval_ptr_dtor(&fci.params[i]);
@@ -275,11 +275,11 @@ PHP_METHOD(domxpath, __construct)
RETURN_FALSE;
}
- intern = Z_DOMOBJ_P(id);
+ intern = Z_XPATHOBJ_P(id);
if (intern != NULL) {
- oldctx = (xmlXPathContextPtr)intern->ptr;
+ oldctx = (xmlXPathContextPtr)intern->dom.ptr;
if (oldctx != NULL) {
- php_libxml_decrement_doc_ref((php_libxml_node_object *)intern TSRMLS_CC);
+ php_libxml_decrement_doc_ref((php_libxml_node_object *) &intern->dom TSRMLS_CC);
xmlXPathFreeContext(oldctx);
}
@@ -290,10 +290,10 @@ PHP_METHOD(domxpath, __construct)
(const xmlChar *) "http://php.net/xpath",
dom_xpath_ext_function_object_php);
- intern->ptr = ctx;
+ intern->dom.ptr = ctx;
ctx->userData = (void *)intern;
- intern->document = docobj->document;
- php_libxml_increment_doc_ref((php_libxml_node_object *)intern, docp TSRMLS_CC);
+ intern->dom.document = docobj->document;
+ php_libxml_increment_doc_ref((php_libxml_node_object *) &intern->dom, docp TSRMLS_CC);
}
}
/* }}} end DOMXPath::__construct */
@@ -326,9 +326,9 @@ PHP_FUNCTION(dom_xpath_register_ns)
return;
}
- intern = Z_DOMOBJ_P(id);
+ intern = Z_XPATHOBJ_P(id);
- ctxp = (xmlXPathContextPtr) intern->ptr;
+ ctxp = (xmlXPathContextPtr) intern->dom.ptr;
if (ctxp == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid XPath Context");
RETURN_FALSE;
@@ -343,13 +343,10 @@ PHP_FUNCTION(dom_xpath_register_ns)
static void dom_xpath_iter(zval *baseobj, dom_object *intern) /* {{{ */
{
- dom_nnodemap_object *mapptr;
+ dom_nnodemap_object *mapptr = (dom_nnodemap_object *) intern->ptr;
- mapptr = (dom_nnodemap_object *)intern->ptr;
- Z_ADDREF_P(baseobj);
- mapptr->baseobj = Z_OBJ_P(baseobj);
+ ZVAL_COPY_VALUE(&mapptr->baseobj_zv, baseobj);
mapptr->nodetype = DOM_NODESET;
-
}
/* }}} */
@@ -371,9 +368,9 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
return;
}
- intern = Z_DOMOBJ_P(id);
+ intern = Z_XPATHOBJ_P(id);
- ctxp = (xmlXPathContextPtr) intern->ptr;
+ ctxp = (xmlXPathContextPtr) intern->dom.ptr;
if (ctxp == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid XPath Context");
RETURN_FALSE;
@@ -466,7 +463,7 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
node->parent = nsparent;
node->ns = curns;
}
- php_dom_create_object(node, &child, (dom_object *)intern TSRMLS_CC);
+ php_dom_create_object(node, &child, &intern->dom TSRMLS_CC);
add_next_index_zval(&retval, &child);
}
}
@@ -522,7 +519,7 @@ PHP_FUNCTION(dom_xpath_register_php_functions)
DOM_GET_THIS(id);
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "a", &array_value) == SUCCESS) {
- intern = Z_DOMOBJ_P(id);
+ intern = Z_XPATHOBJ_P(id);
zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value));
while ((entry = zend_hash_get_current_data(Z_ARRVAL_P(array_value)))) {
zend_string *str = zval_get_string(entry TSRMLS_CC);
@@ -535,13 +532,13 @@ PHP_FUNCTION(dom_xpath_register_php_functions)
RETURN_TRUE;
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == SUCCESS) {
- intern = Z_DOMOBJ_P(id);
+ intern = Z_XPATHOBJ_P(id);
ZVAL_LONG(&new_string, 1);
zend_hash_update(intern->registered_phpfunctions, name, &new_string);
intern->registerPhpFunctions = 2;
} else {
- intern = Z_DOMOBJ_P(id);
+ intern = Z_XPATHOBJ_P(id);
intern->registerPhpFunctions = 1;
}
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index 705045eee4..cfa339fe24 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -86,6 +86,7 @@ ZEND_GET_MODULE(libxml)
/* {{{ function prototypes */
static PHP_MINIT_FUNCTION(libxml);
static PHP_RINIT_FUNCTION(libxml);
+static PHP_RSHUTDOWN_FUNCTION(libxml);
static PHP_MSHUTDOWN_FUNCTION(libxml);
static PHP_MINFO_FUNCTION(libxml);
static int php_libxml_post_deactivate();
@@ -138,7 +139,7 @@ zend_module_entry libxml_module_entry = {
PHP_MINIT(libxml), /* extension-wide startup function */
PHP_MSHUTDOWN(libxml), /* extension-wide shutdown function */
PHP_RINIT(libxml), /* per-request startup function */
- NULL, /* per-request shutdown function */
+ PHP_RSHUTDOWN(libxml), /* per-request shutdown function */
PHP_MINFO(libxml), /* information function */
NO_VERSION_YET,
PHP_MODULE_GLOBALS(libxml), /* globals descriptor */
@@ -588,7 +589,7 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
if (context->memb == NULL) { \
add_assoc_null_ex(ctxzv, #memb, sizeof(#memb) - 1); \
} else { \
- add_assoc_string_ex(ctxzv, #memb, sizeof(#memb - 1), \
+ add_assoc_string_ex(ctxzv, #memb, sizeof(#memb) - 1, \
(char *)context->memb); \
}
@@ -862,6 +863,12 @@ static PHP_RINIT_FUNCTION(libxml)
return SUCCESS;
}
+static PHP_RSHUTDOWN_FUNCTION(libxml)
+{
+ _php_libxml_destroy_fci(&LIBXML(entity_loader).fci, &LIBXML(entity_loader).object);
+
+ return SUCCESS;
+}
static PHP_MSHUTDOWN_FUNCTION(libxml)
{
@@ -898,8 +905,6 @@ static int php_libxml_post_deactivate()
}
xmlResetLastError();
- _php_libxml_destroy_fci(&LIBXML(entity_loader).fci, &LIBXML(entity_loader).object);
-
return SUCCESS;
}
@@ -1152,7 +1157,7 @@ PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object TSRMLS_DC)
while (ce->parent != NULL) {
ce = ce->parent;
}
- if ((export_hnd = zend_hash_find_ptr(&php_libxml_exports, ce->name)) == SUCCESS) {
+ if ((export_hnd = zend_hash_find_ptr(&php_libxml_exports, ce->name))) {
node = export_hnd->export_func(object TSRMLS_CC);
}
}
diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt
index 51ab777052..938229ff86 100644
--- a/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt
+++ b/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt
@@ -31,6 +31,7 @@ var_dump($dd->validate());
echo "Done.\n";
+?>
--EXPECT--
string(10) "-//FOO/BAR"
string(25) "http://example.com/foobar"
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 86db53f1da..2260af80bc 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -683,7 +683,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
/* T = CAST(X, String), ECHO(T) => NOP, ECHO(X) */
if ((opline->opcode == ZEND_ECHO || opline->opcode == ZEND_PRINT) &&
- ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+ ZEND_OP1_TYPE(opline) & (IS_TMP_VAR|IS_VAR) &&
VAR_SOURCE(opline->op1) &&
VAR_SOURCE(opline->op1)->opcode == ZEND_CAST &&
VAR_SOURCE(opline->op1)->extended_value == IS_STRING) {
@@ -785,20 +785,23 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
* IS_EQ(FALSE, X) => BOOL_NOT(X)
* IS_NOT_EQ(TRUE, X) => BOOL_NOT(X)
* IS_NOT_EQ(FALSE, X) => BOOL(X)
+ * CASE(TRUE, X) => BOOL(X)
+ * CASE(FALSE, X) => BOOL_NOT(X)
*/
if (opline->opcode == ZEND_IS_EQUAL ||
- opline->opcode == ZEND_IS_NOT_EQUAL) {
+ opline->opcode == ZEND_IS_NOT_EQUAL ||
+ opline->opcode == ZEND_CASE) {
if (ZEND_OP1_TYPE(opline) == IS_CONST &&
Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_BOOL) {
opline->opcode =
- ((opline->opcode == ZEND_IS_EQUAL) == Z_LVAL(ZEND_OP1_LITERAL(opline)))?
+ ((opline->opcode != ZEND_IS_NOT_EQUAL) == Z_LVAL(ZEND_OP1_LITERAL(opline)))?
ZEND_BOOL : ZEND_BOOL_NOT;
COPY_NODE(opline->op1, opline->op2);
SET_UNUSED(opline->op2);
} else if (ZEND_OP2_TYPE(opline) == IS_CONST &&
Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_BOOL) {
opline->opcode =
- ((opline->opcode == ZEND_IS_EQUAL) == Z_LVAL(ZEND_OP2_LITERAL(opline)))?
+ ((opline->opcode != ZEND_IS_NOT_EQUAL) == Z_LVAL(ZEND_OP2_LITERAL(opline)))?
ZEND_BOOL : ZEND_BOOL_NOT;
SET_UNUSED(opline->op2);
}
@@ -1118,6 +1121,10 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
opline->opcode = ZEND_CONCAT;
literal_dtor(&ZEND_OP2_LITERAL(src)); /* will take care of empty_string too */
MAKE_NOP(src);
+//??? This optimization can't work anymore because ADD_VAR returns IS_TMP_VAR
+//??? and ZEND_CAST returns IS_VAR.
+//??? BTW: it wan't used for long time, because we don't use INIT_STRING
+#if 0
} else if (opline->opcode == ZEND_ADD_VAR &&
ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
VAR_SOURCE(opline->op1) &&
@@ -1130,11 +1137,12 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
MAKE_NOP(src);
opline->opcode = ZEND_CAST;
opline->extended_value = IS_STRING;
+#endif
} else if ((opline->opcode == ZEND_ADD_STRING ||
opline->opcode == ZEND_ADD_CHAR ||
opline->opcode == ZEND_ADD_VAR ||
opline->opcode == ZEND_CONCAT) &&
- ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+ ZEND_OP1_TYPE(opline) == (IS_TMP_VAR|IS_VAR) &&
VAR_SOURCE(opline->op1) &&
VAR_SOURCE(opline->op1)->opcode == ZEND_CAST &&
VAR_SOURCE(opline->op1)->extended_value == IS_STRING) {
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c
index 1905e66136..6c3bf41ec3 100644
--- a/ext/opcache/Optimizer/compact_literals.c
+++ b/ext/opcache/Optimizer/compact_literals.c
@@ -63,7 +63,7 @@ static void optimizer_literal_obj_info(literal_info *info,
* In general it's also possible to do it for any CV variable as well,
* but it would require complex dataflow and/or type analysis.
*/
- if (Z_TYPE(op_array->literals[constant].constant) == IS_STRING &&
+ if (Z_TYPE(op_array->literals[constant]) == IS_STRING &&
op_type == IS_UNUSED) {
LITERAL_INFO_OBJ(constant, kind, 1, slots, related, op_array->this_var);
} else {
@@ -285,10 +285,10 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC)
for (i = 0; i < op_array->last_literal; i++) {
if (!info[i].flags) {
/* unsed literal */
- zval_dtor(&op_array->literals[i].constant);
+ zval_dtor(&op_array->literals[i]);
continue;
}
- switch (Z_TYPE(op_array->literals[i].constant)) {
+ switch (Z_TYPE(op_array->literals[i])) {
case IS_NULL:
if (l_null < 0) {
l_null = j;
@@ -301,7 +301,7 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC)
map[i] = l_null;
break;
case IS_BOOL:
- if (Z_LVAL(op_array->literals[i].constant)) {
+ if (Z_LVAL(op_array->literals[i])) {
if (l_true < 0) {
l_true = j;
if (i != j) {
@@ -324,11 +324,11 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC)
}
break;
case IS_LONG:
- if ((pos = (int)zend_hash_index_find_ptr(&hash, Z_LVAL(op_array->literals[i].constant))) != 0) {
+ if ((pos = (int)zend_hash_index_find_ptr(&hash, Z_LVAL(op_array->literals[i]))) != 0) {
map[i] = pos - 1;
} else {
map[i] = j;
- zend_hash_index_update_ptr(&hash, Z_LVAL(op_array->literals[i].constant), (void*)j + 1);
+ zend_hash_index_update_ptr(&hash, Z_LVAL(op_array->literals[i]), (void*)j + 1);
if (i != j) {
op_array->literals[j] = op_array->literals[i];
info[j] = info[i];
@@ -337,11 +337,11 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC)
}
break;
case IS_DOUBLE:
- if ((pos = (int)zend_hash_str_find_ptr(&hash, (char*)&Z_DVAL(op_array->literals[i].constant), sizeof(double))) != 0) {
+ if ((pos = (int)zend_hash_str_find_ptr(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double))) != 0) {
map[i] = pos - 1;
} else {
map[i] = j;
- zend_hash_str_add_ptr(&hash, (char*)&Z_DVAL(op_array->literals[i].constant), sizeof(double), (void*)j + 1);
+ zend_hash_str_add_ptr(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double), (void*)j + 1);
if (i != j) {
op_array->literals[j] = op_array->literals[i];
info[j] = info[i];
@@ -353,37 +353,37 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC)
case IS_CONSTANT:
if (info[i].flags & LITERAL_MAY_MERGE) {
if (info[i].flags & LITERAL_EX_OBJ) {
- int key_len = MAX_LENGTH_OF_LONG + sizeof("->") + Z_STRLEN(op_array->literals[i].constant);
+ int key_len = MAX_LENGTH_OF_LONG + sizeof("->") + Z_STRLEN(op_array->literals[i]);
key = STR_ALLOC(key_len, 0);
- key->len = snprintf(key->val, key->len-1, "%d->%s", info[i].u.num, Z_STRVAL(op_array->literals[i].constant));
+ key->len = snprintf(key->val, key->len-1, "%d->%s", info[i].u.num, Z_STRVAL(op_array->literals[i]));
} else if (info[i].flags & LITERAL_EX_CLASS) {
int key_len;
- zval *class_name = &op_array->literals[(info[i].u.num < i) ? map[info[i].u.num] : info[i].u.num].constant;
- key_len = Z_STRLEN_P(class_name) + sizeof("::") + Z_STRLEN(op_array->literals[i].constant);
+ zval *class_name = &op_array->literals[(info[i].u.num < i) ? map[info[i].u.num] : info[i].u.num];
+ key_len = Z_STRLEN_P(class_name) + sizeof("::") + Z_STRLEN(op_array->literals[i]);
key = STR_ALLOC(key_len, 0);
memcpy(key->val, Z_STRVAL_P(class_name), Z_STRLEN_P(class_name));
memcpy(key->val + Z_STRLEN_P(class_name), "::", sizeof("::") - 1);
memcpy(key->val + Z_STRLEN_P(class_name) + sizeof("::") - 1,
- Z_STRVAL(op_array->literals[i].constant),
- Z_STRLEN(op_array->literals[i].constant) + 1);
+ Z_STRVAL(op_array->literals[i]),
+ Z_STRLEN(op_array->literals[i]) + 1);
} else {
- key = STR_INIT(Z_STRVAL(op_array->literals[i].constant), Z_STRLEN(op_array->literals[i].constant), 0);
+ key = STR_INIT(Z_STRVAL(op_array->literals[i]), Z_STRLEN(op_array->literals[i]), 0);
}
key->h = zend_hash_func(key->val, key->len);
key->h += info[i].flags;
}
if ((info[i].flags & LITERAL_MAY_MERGE) &&
(pos = (int)zend_hash_find_ptr(&hash, key)) != 0 &&
- Z_TYPE(op_array->literals[i].constant) == Z_TYPE(op_array->literals[pos-1].constant) &&
+ Z_TYPE(op_array->literals[i]) == Z_TYPE(op_array->literals[pos-1]) &&
info[i].flags == info[pos-1].flags) {
STR_RELEASE(key);
map[i] = pos - 1;
- zval_dtor(&op_array->literals[i].constant);
+ zval_dtor(&op_array->literals[i]);
n = LITERAL_NUM_RELATED(info[i].flags);
while (n > 1) {
i++;
- zval_dtor(&op_array->literals[i].constant);
+ zval_dtor(&op_array->literals[i]);
n--;
}
} else {
@@ -404,7 +404,7 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC)
//??? }
//??? }
if (LITERAL_NUM_SLOTS(info[i].flags)) {
- op_array->literals[j].cache_slot = cache_slots;
+ Z_CACHE_SLOT(op_array->literals[j]) = cache_slots;
cache_slots += LITERAL_NUM_SLOTS(info[i].flags);
}
j++;
diff --git a/ext/opcache/Optimizer/optimize_func_calls.c b/ext/opcache/Optimizer/optimize_func_calls.c
index d7461b5908..f9ae14290f 100644
--- a/ext/opcache/Optimizer/optimize_func_calls.c
+++ b/ext/opcache/Optimizer/optimize_func_calls.c
@@ -25,7 +25,7 @@ static void optimize_func_calls(zend_op_array *op_array, zend_persistent_script
case ZEND_INIT_NS_FCALL_BY_NAME:
if (ZEND_OP2_TYPE(opline) == IS_CONST) {
zend_function *func;
- zval *function_name = &op_array->literals[opline->op2.constant + 1].constant;
+ zval *function_name = &op_array->literals[opline->op2.constant + 1];
if ((func = zend_hash_find_ptr(&script->function_table,
Z_STR_P(function_name))) != NULL) {
call_stack[call].func = func;
@@ -53,10 +53,10 @@ static void optimize_func_calls(zend_op_array *op_array, zend_persistent_script
opline->opcode = ZEND_DO_FCALL;
ZEND_OP1_TYPE(opline) = IS_CONST;
opline->op1.constant = fcall->op2.constant + 1;
- op_array->literals[fcall->op2.constant + 1].cache_slot = op_array->literals[fcall->op2.constant].cache_slot;
+ Z_CACHE_SLOT(op_array->literals[fcall->op2.constant + 1]) = Z_CACHE_SLOT(op_array->literals[fcall->op2.constant]);
literal_dtor(&ZEND_OP2_LITERAL(fcall));
if (fcall->opcode == ZEND_INIT_NS_FCALL_BY_NAME) {
- literal_dtor(&op_array->literals[fcall->op2.constant + 2].constant);
+ literal_dtor(&op_array->literals[fcall->op2.constant + 2]);
}
MAKE_NOP(fcall);
} else if (opline->extended_value == 0 &&
@@ -69,7 +69,7 @@ static void optimize_func_calls(zend_op_array *op_array, zend_persistent_script
opline->opcode = ZEND_DO_FCALL;
ZEND_OP1_TYPE(opline) = IS_CONST;
opline->op1.constant = fcall->op2.constant + 1;
- op_array->literals[fcall->op2.constant + 1].cache_slot = op_array->literals[fcall->op2.constant].cache_slot;
+ Z_CACHE_SLOT(op_array->literals[fcall->op2.constant + 1]) = Z_CACHE_SLOT(op_array->literals[fcall->op2.constant]);
literal_dtor(&ZEND_OP2_LITERAL(fcall));
MAKE_NOP(fcall);
}
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c
index 9edff53d39..207b8d0e61 100644
--- a/ext/opcache/Optimizer/pass1_5.c
+++ b/ext/opcache/Optimizer/pass1_5.c
@@ -102,7 +102,11 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
literal_dtor(&ZEND_OP1_LITERAL(opline));
MAKE_NOP(opline);
- replace_tmp_by_const(op_array, opline + 1, tv, &res TSRMLS_CC);
+ if (opline->result_type == IS_TMP_VAR) {
+ replace_tmp_by_const(op_array, opline + 1, tv, &res TSRMLS_CC);
+ } else /* if (opline->result_type == IS_VAR) */ {
+ replace_var_by_const(op_array, opline + 1, tv, &res TSRMLS_CC);
+ }
} else if (opline->extended_value == IS_BOOL) {
/* T = CAST(X, IS_BOOL) => T = BOOL(X) */
opline->opcode = ZEND_BOOL;
@@ -270,7 +274,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
ce = op_array->scope;
} else {
if ((ce = zend_hash_find_ptr(EG(class_table),
- Z_STR(op_array->literals[opline->op1.constant + 1].constant))) == NULL ||
+ Z_STR(op_array->literals[opline->op1.constant + 1]))) == NULL ||
(ce->type == ZEND_INTERNAL_CLASS &&
ce->info.internal.module->type != MODULE_PERSISTENT) ||
(ce->type == ZEND_USER_CLASS &&
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index f92c866e41..0498bcba07 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -109,9 +109,9 @@ int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC)
{
int i = op_array->last_literal;
op_array->last_literal++;
- op_array->literals = (zend_literal*)erealloc(op_array->literals, op_array->last_literal * sizeof(zend_literal));
- ZVAL_COPY_VALUE(&op_array->literals[i].constant, zv);
- op_array->literals[i].cache_slot = -1;
+ op_array->literals = (zval*)erealloc(op_array->literals, op_array->last_literal * sizeof(zval));
+ ZVAL_COPY_VALUE(&op_array->literals[i], zv);
+ Z_CACHE_SLOT(op_array->literals[i]) = -1;
//??? Z_SET_REFCOUNT(op_array->literals[i].constant, 2);
//??? Z_SET_ISREF(op_array->literals[i].constant);
return i;
@@ -171,10 +171,10 @@ static void update_op1_const(zend_op_array *op_array,
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
STR_HASH_VAL(Z_STR(ZEND_OP1_LITERAL(opline)));
//??? Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
- op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++;
+ Z_CACHE_SLOT(op_array->literals[opline->op1.constant]) = op_array->last_cache_slot++;
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
- STR_HASH_VAL(Z_STR(op_array->literals[opline->op1.constant+1].constant));
+ STR_HASH_VAL(Z_STR(op_array->literals[opline->op1.constant+1]));
//??? op_array->literals[opline->op1.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op1.constant+1].constant), Z_STRLEN(op_array->literals[opline->op1.constant+1].constant) + 1);
break;
case ZEND_DO_FCALL:
@@ -182,7 +182,7 @@ static void update_op1_const(zend_op_array *op_array,
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
STR_HASH_VAL(Z_STR(ZEND_OP1_LITERAL(opline)));
//??? Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
- op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++;
+ Z_CACHE_SLOT(op_array->literals[opline->op1.constant]) = op_array->last_cache_slot++;
break;
default:
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
@@ -223,17 +223,17 @@ static void update_op2_const(zend_op_array *op_array,
case ZEND_ISSET_ISEMPTY_VAR:
case ZEND_ADD_INTERFACE:
case ZEND_ADD_TRAIT:
- op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot++;
+ Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot++;
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
- STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1].constant));
+ STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1]));
//??? op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1);
break;
case ZEND_INIT_METHOD_CALL:
case ZEND_INIT_STATIC_METHOD_CALL:
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
- STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1].constant));
+ STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1]));
//??? op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1);
/* break missing intentionally */
/*case ZEND_FETCH_CONSTANT:*/
@@ -250,7 +250,7 @@ static void update_op2_const(zend_op_array *op_array,
case ZEND_POST_INC_OBJ:
case ZEND_POST_DEC_OBJ:
case ZEND_ISSET_ISEMPTY_PROP_OBJ:
- op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot;
+ Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot;
op_array->last_cache_slot += 2;
break;
case ZEND_ASSIGN_ADD:
@@ -265,7 +265,7 @@ static void update_op2_const(zend_op_array *op_array,
case ZEND_ASSIGN_BW_AND:
case ZEND_ASSIGN_BW_XOR:
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
- op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot;
+ Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot;
op_array->last_cache_slot += 2;
}
break;
@@ -307,7 +307,7 @@ check_numeric:
if (numeric) {
zval_dtor(val);
ZVAL_LONG(val, index);
- op_array->literals[opline->op2.constant].constant = *val;
+ op_array->literals[opline->op2.constant] = *val;
}
}
break;
@@ -488,10 +488,10 @@ static void zend_accel_optimize(zend_op_array *op_array,
while (opline < end) {
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
if (opline->op1_type == IS_CONST) {
- opline->op1.constant = opline->op1.literal - op_array->literals;
+ opline->op1.constant = opline->op1.zv - op_array->literals;
}
if (opline->op2_type == IS_CONST) {
- opline->op2.constant = opline->op2.literal - op_array->literals;
+ opline->op2.constant = opline->op2.zv - op_array->literals;
}
#endif
switch (opline->opcode) {
@@ -529,10 +529,10 @@ static void zend_accel_optimize(zend_op_array *op_array,
while (opline < end) {
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
if (opline->op1_type == IS_CONST) {
- opline->op1.zv = &op_array->literals[opline->op1.constant].constant;
+ opline->op1.zv = &op_array->literals[opline->op1.constant];
}
if (opline->op2_type == IS_CONST) {
- opline->op2.zv = &op_array->literals[opline->op2.constant].constant;
+ opline->op2.zv = &op_array->literals[opline->op2.constant];
}
#endif
switch (opline->opcode) {
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index 192b2ec6d0..9db5739a10 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -351,11 +351,11 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC);
# define ZEND_OP1_TYPE(opline) (opline)->op1_type
# define ZEND_OP1(opline) (opline)->op1
# define ZEND_OP1_CONST(opline) (*(opline)->op1.zv)
-# define ZEND_OP1_LITERAL(opline) (op_array)->literals[(opline)->op1.constant].constant
+# define ZEND_OP1_LITERAL(opline) (op_array)->literals[(opline)->op1.constant]
# define ZEND_OP2_TYPE(opline) (opline)->op2_type
# define ZEND_OP2(opline) (opline)->op2
# define ZEND_OP2_CONST(opline) (*(opline)->op2.zv)
-# define ZEND_OP2_LITERAL(opline) (op_array)->literals[(opline)->op2.constant].constant
+# define ZEND_OP2_LITERAL(opline) (op_array)->literals[(opline)->op2.constant]
# define ZEND_DONE_PASS_TWO(op_array) (((op_array)->fn_flags & ZEND_ACC_DONE_PASS_TWO) != 0)
# define ZEND_CE_FILENAME(ce) (ce)->info.user.filename
# define ZEND_CE_DOC_COMMENT(ce) (ce)->info.user.doc_comment
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c
index 08051b47ee..51051dd6ce 100644
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@ -409,7 +409,6 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind)
q->key = NULL;
} else {
q->key = zend_clone_str(p->key TSRMLS_CC);
- GC_FLAGS(q->key) = GC_FLAGS(p->key);
}
/* Copy data */
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index eea260d53e..ca8835c2ed 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -179,7 +179,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
int has_jmp = 0;
#endif
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
- zend_literal *orig_literals = NULL;
+ zval *orig_literals = NULL;
#endif
if (op_array->type != ZEND_USER_FUNCTION) {
@@ -228,12 +228,12 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
ZEND_ASSERT(orig_literals != NULL);
op_array->literals = orig_literals;
} else {
- zend_literal *p = zend_accel_memdup(op_array->literals, sizeof(zend_literal) * op_array->last_literal);
- zend_literal *end = p + op_array->last_literal;
+ zval *p = zend_accel_memdup(op_array->literals, sizeof(zval) * op_array->last_literal);
+ zval *end = p + op_array->last_literal;
orig_literals = op_array->literals;
op_array->literals = p;
while (p < end) {
- zend_persist_zval(&p->constant TSRMLS_CC);
+ zend_persist_zval(p TSRMLS_CC);
p++;
}
efree(orig_literals);
diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c
index b9cf4240c1..20e6b083c4 100644
--- a/ext/opcache/zend_persist_calc.c
+++ b/ext/opcache/zend_persist_calc.c
@@ -156,7 +156,6 @@ static uint zend_persist_zval_calc(zval *z TSRMLS_DC)
static uint zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC)
{
- zend_op *opline, *end;
START_SIZE();
if (op_array->type != ZEND_USER_FUNCTION) {
@@ -181,11 +180,11 @@ static uint zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC)
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
if (op_array->literals) {
- zend_literal *p = op_array->literals;
- zend_literal *end = p + op_array->last_literal;
- ADD_DUP_SIZE(op_array->literals, sizeof(zend_literal) * op_array->last_literal);
+ zval *p = op_array->literals;
+ zval *end = p + op_array->last_literal;
+ ADD_DUP_SIZE(op_array->literals, sizeof(zval) * op_array->last_literal);
while (p < end) {
- ADD_SIZE(zend_persist_zval_calc(&p->constant TSRMLS_CC));
+ ADD_SIZE(zend_persist_zval_calc(p TSRMLS_CC));
p++;
}
}
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index a38c5cdebd..724b667bde 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1250,14 +1250,12 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub
/* Duplicate subject string for repeated replacement */
subject_value = STR_INIT(Z_STRVAL_P(subject), Z_STRLEN_P(subject), 0);
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(regex));
-
replace_value = replace;
if (Z_TYPE_P(replace) == IS_ARRAY && !is_callable_replace)
zend_hash_internal_pointer_reset(Z_ARRVAL_P(replace));
/* For each entry in the regex array, get the entry */
- while ((regex_entry = zend_hash_get_current_data(Z_ARRVAL_P(regex))) != NULL) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(regex), regex_entry) {
/* Make sure we're dealing with strings. */
convert_to_string_ex(regex_entry);
@@ -1293,8 +1291,7 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub
return NULL;
}
- zend_hash_move_forward(Z_ARRVAL_P(regex));
- }
+ } ZEND_HASH_FOREACH_END();
zval_ptr_dtor(&tmp_subject);
return subject_value;
@@ -1365,32 +1362,24 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
/* if subject is an array */
if (Z_TYPE_P(subject) == IS_ARRAY) {
array_init(return_value);
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(subject));
/* For each subject entry, convert it to string, then perform replacement
and add the result to the return_value array. */
- while ((subject_entry = zend_hash_get_current_data(Z_ARRVAL_P(subject))) != NULL) {
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(subject), num_key, string_key, subject_entry) {
old_replace_count = replace_count;
if ((result = php_replace_in_subject(regex, replace, subject_entry, limit_val, is_callable_replace, &replace_count TSRMLS_CC)) != NULL) {
if (!is_filter || replace_count > old_replace_count) {
/* Add to return array */
- switch(zend_hash_get_current_key(Z_ARRVAL_P(subject), &string_key, &num_key, 0))
- {
- case HASH_KEY_IS_STRING:
+ if (string_key) {
add_assoc_str_ex(return_value, string_key->val, string_key->len, result);
- break;
-
- case HASH_KEY_IS_LONG:
+ } else {
add_index_str(return_value, num_key, result);
- break;
}
} else {
STR_FREE(result);
}
}
-
- zend_hash_move_forward(Z_ARRVAL_P(subject));
- }
+ } ZEND_HASH_FOREACH_END();
} else { /* if subject is not an array */
old_replace_count = replace_count;
if ((result = php_replace_in_subject(regex, replace, subject, limit_val, is_callable_replace, &replace_count TSRMLS_CC)) != NULL) {
@@ -1781,8 +1770,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;
/* Go through the input array */
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(input));
- while ((entry = zend_hash_get_current_data(Z_ARRVAL_P(input))) != NULL) {
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_key, string_key, entry) {
zval subject, *ref_entry = entry;
if (Z_ISREF_P(entry)) {
@@ -1818,15 +1806,10 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
}
/* Add to return array */
- switch (zend_hash_get_current_key(Z_ARRVAL_P(input), &string_key, &num_key, 0))
- {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key, ref_entry);
- break;
-
- case HASH_KEY_IS_LONG:
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, ref_entry);
- break;
+ if (string_key) {
+ zend_hash_update(Z_ARRVAL_P(return_value), string_key, ref_entry);
+ } else {
+ zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, ref_entry);
}
}
@@ -1834,9 +1817,8 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
zval_dtor(&subject);
}
- zend_hash_move_forward(Z_ARRVAL_P(input));
- }
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(input));
+ } ZEND_HASH_FOREACH_END();
+
/* Clean up */
efree(offsets);
}
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 9aea15c882..d2a6790d6b 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -44,7 +44,7 @@
#define reflection_update_property(object, name, value) do { \
zval member; \
ZVAL_STRINGL(&member, name, sizeof(name)-1); \
- zend_std_write_property(object, &member, value, NULL TSRMLS_CC); \
+ zend_std_write_property(object, &member, value, -1 TSRMLS_CC); \
if (Z_REFCOUNTED_P(value)) Z_DELREF_P(value); \
zval_ptr_dtor(&member); \
} while (0)
@@ -1800,7 +1800,8 @@ ZEND_METHOD(reflection_function, getFileName)
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
- RETURN_STR(STR_COPY(fptr->op_array.filename));
+// TODO: we have to duplicate it, becaise it may be in opcache SHM ???
+ RETURN_STR(STR_DUP(fptr->op_array.filename, 0));
}
RETURN_FALSE;
}
@@ -1854,7 +1855,8 @@ ZEND_METHOD(reflection_function, getDocComment)
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
- RETURN_STR(STR_COPY(fptr->op_array.doc_comment));
+// TODO: we have to duplicate it, becaise it may be stored in opcache SHM ???
+ RETURN_STR(STR_DUP(fptr->op_array.doc_comment, 0));
}
RETURN_FALSE;
}
@@ -3428,7 +3430,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue)
GET_REFLECTION_OBJECT_PTR(ce);
zend_update_class_constants(ce TSRMLS_CC);
- prop = zend_std_get_static_property(ce, name, 1, NULL TSRMLS_CC);
+ prop = zend_std_get_static_property(ce, name, 1, -1 TSRMLS_CC);
if (!prop) {
if (def_value) {
RETURN_ZVAL(def_value, 1, 0);
@@ -3461,7 +3463,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
GET_REFLECTION_OBJECT_PTR(ce);
zend_update_class_constants(ce TSRMLS_CC);
- variable_ptr = zend_std_get_static_property(ce, name, 1, NULL TSRMLS_CC);
+ variable_ptr = zend_std_get_static_property(ce, name, 1, -1 TSRMLS_CC);
if (!variable_ptr) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %s does not have a property named %s", ce->name->val, name->val);
@@ -3566,7 +3568,8 @@ ZEND_METHOD(reflection_class, getFileName)
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
- RETURN_STR(STR_COPY(ce->info.user.filename));
+// TODO: we have to duplicate it, becaise it may be stored in opcache SHM ???
+ RETURN_STR(STR_DUP(ce->info.user.filename, 0));
}
RETURN_FALSE;
}
@@ -3813,7 +3816,7 @@ ZEND_METHOD(reflection_class, hasProperty)
} else {
if (Z_TYPE(intern->obj) != IS_UNDEF && Z_OBJ_HANDLER(intern->obj, has_property)) {
ZVAL_STR(&property, STR_COPY(name));
- if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, 0 TSRMLS_CC)) {
+ if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, -1 TSRMLS_CC)) {
zval_ptr_dtor(&property);
RETURN_TRUE;
}
@@ -6065,7 +6068,7 @@ const zend_function_entry reflection_ext_functions[] = { /* {{{ */
static zend_object_handlers *zend_std_obj_handlers;
/* {{{ _reflection_write_property */
-static void _reflection_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC)
+static void _reflection_write_property(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC)
{
if ((Z_TYPE_P(member) == IS_STRING)
&& zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member))
@@ -6077,7 +6080,7 @@ static void _reflection_write_property(zval *object, zval *member, zval *value,
}
else
{
- zend_std_obj_handlers->write_property(object, member, value, key TSRMLS_CC);
+ zend_std_obj_handlers->write_property(object, member, value, cache_slot TSRMLS_CC);
}
}
/* }}} */
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 95225d1472..1c6a20c352 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -382,7 +382,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
/* {{{ sxe_property_read()
*/
-static zval *sxe_property_read(zval *object, zval *member, int type, const zend_literal *key, zval *rv TSRMLS_DC)
+static zval *sxe_property_read(zval *object, zval *member, int type, zend_uint cache_slot, zval *rv TSRMLS_DC)
{
return sxe_prop_dim_read(object, member, 1, 0, type, rv TSRMLS_CC);
}
@@ -666,7 +666,7 @@ next_iter:
/* {{{ sxe_property_write()
*/
-static void sxe_property_write(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC)
+static void sxe_property_write(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC)
{
sxe_prop_dim_write(object, member, value, 1, 0, NULL TSRMLS_CC);
}
@@ -680,7 +680,7 @@ static void sxe_dimension_write(zval *object, zval *offset, zval *value TSRMLS_D
}
/* }}} */
-static zval *sxe_property_get_adr(zval *object, zval *member, int fetch_type, const zend_literal *key TSRMLS_DC) /* {{{ */
+static zval *sxe_property_get_adr(zval *object, zval *member, int fetch_type, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -832,7 +832,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
/* {{{ sxe_property_exists()
*/
-static int sxe_property_exists(zval *object, zval *member, int check_empty, const zend_literal *key TSRMLS_DC)
+static int sxe_property_exists(zval *object, zval *member, int check_empty, zend_uint cache_slot TSRMLS_DC)
{
return sxe_prop_dim_exists(object, member, check_empty, 1, 0 TSRMLS_CC);
}
@@ -957,7 +957,7 @@ next_iter:
/* {{{ sxe_property_delete()
*/
-static void sxe_property_delete(zval *object, zval *member, const zend_literal *key TSRMLS_DC)
+static void sxe_property_delete(zval *object, zval *member, zend_uint cache_slot TSRMLS_DC)
{
sxe_prop_dim_delete(object, member, 1, 0 TSRMLS_CC);
}
@@ -971,7 +971,7 @@ static void sxe_dimension_delete(zval *object, zval *offset TSRMLS_DC)
}
/* }}} */
-static inline zend_string * sxe_xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, int inLine) /* {{{ */
+static inline zend_string *sxe_xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, int inLine TSRMLS_DC) /* {{{ */
{
xmlChar *tmp = xmlNodeListGetString(doc, list, inLine);
zend_string *res;
@@ -1085,7 +1085,7 @@ static HashTable *sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{{
test = sxe->iter.name && sxe->iter.type == SXE_ITER_ATTRLIST;
while (attr) {
if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr)attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- ZVAL_STR(&value, sxe_xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, attr->children, 1));
+ ZVAL_STR(&value, sxe_xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, attr->children, 1 TSRMLS_CC));
namelen = xmlStrlen(attr->name);
if (ZVAL_IS_UNDEF(&zattr)) {
array_init(&zattr);
@@ -1103,7 +1103,7 @@ static HashTable *sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{{
if (node && sxe->iter.type != SXE_ITER_ATTRLIST) {
if (node->type == XML_ATTRIBUTE_NODE) {
- ZVAL_STR(&value, sxe_xmlNodeListGetString(node->doc, node->children, 1));
+ ZVAL_STR(&value, sxe_xmlNodeListGetString(node->doc, node->children, 1 TSRMLS_CC));
zend_hash_next_index_insert(rv, &value);
node = NULL;
} else if (sxe->iter.type != SXE_ITER_CHILD) {
@@ -1128,7 +1128,7 @@ static HashTable *sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{{
const xmlChar *cur = node->content;
if (*cur != 0) {
- ZVAL_STR(&value, sxe_xmlNodeListGetString(node->doc, node, 1));
+ ZVAL_STR(&value, sxe_xmlNodeListGetString(node->doc, node, 1 TSRMLS_CC));
zend_hash_next_index_insert(rv, &value);
}
goto next_iter;
@@ -2384,7 +2384,7 @@ PHP_FUNCTION(simplexml_import_dom)
return;
}
- object = (php_libxml_node_object *)Z_SXEOBJ_P(node);
+ object = (php_libxml_node_object *) ((char *) Z_OBJ_P(node) - Z_OBJ_HT_P(node)->offset);
nodep = php_libxml_import_node(node TSRMLS_CC);
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 3d744af3a8..208f9de7a6 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -845,35 +845,35 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /*
}
/* }}} */
-static zval *spl_array_read_property(zval *object, zval *member, int type, const zend_literal *key, zval *rv TSRMLS_DC) /* {{{ */
+static zval *spl_array_read_property(zval *object, zval *member, int type, zend_uint cache_slot, zval *rv TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = Z_SPLARRAY_P(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !std_object_handlers.has_property(object, member, 2, key TSRMLS_CC)) {
+ && !std_object_handlers.has_property(object, member, 2, cache_slot TSRMLS_CC)) {
return spl_array_read_dimension(object, member, type, rv TSRMLS_CC);
}
- return std_object_handlers.read_property(object, member, type, key, rv TSRMLS_CC);
+ return std_object_handlers.read_property(object, member, type, cache_slot, rv TSRMLS_CC);
} /* }}} */
-static void spl_array_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) /* {{{ */
+static void spl_array_write_property(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = Z_SPLARRAY_P(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !std_object_handlers.has_property(object, member, 2, key TSRMLS_CC)) {
+ && !std_object_handlers.has_property(object, member, 2, cache_slot TSRMLS_CC)) {
spl_array_write_dimension(object, member, value TSRMLS_CC);
return;
}
- std_object_handlers.write_property(object, member, value, key TSRMLS_CC);
+ std_object_handlers.write_property(object, member, value, cache_slot TSRMLS_CC);
} /* }}} */
-static zval *spl_array_get_property_ptr_ptr(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */
+static zval *spl_array_get_property_ptr_ptr(zval *object, zval *member, int type, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = Z_SPLARRAY_P(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !std_object_handlers.has_property(object, member, 2, key TSRMLS_CC)) {
+ && !std_object_handlers.has_property(object, member, 2, cache_slot TSRMLS_CC)) {
return spl_array_get_dimension_ptr(1, object, member, type TSRMLS_CC);
}
//!!! FIXME
@@ -881,28 +881,28 @@ static zval *spl_array_get_property_ptr_ptr(zval *object, zval *member, int type
return NULL;
} /* }}} */
-static int spl_array_has_property(zval *object, zval *member, int has_set_exists, const zend_literal *key TSRMLS_DC) /* {{{ */
+static int spl_array_has_property(zval *object, zval *member, int has_set_exists, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = Z_SPLARRAY_P(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !std_object_handlers.has_property(object, member, 2, key TSRMLS_CC)) {
+ && !std_object_handlers.has_property(object, member, 2, cache_slot TSRMLS_CC)) {
return spl_array_has_dimension(object, member, has_set_exists TSRMLS_CC);
}
- return std_object_handlers.has_property(object, member, has_set_exists, key TSRMLS_CC);
+ return std_object_handlers.has_property(object, member, has_set_exists, cache_slot TSRMLS_CC);
} /* }}} */
-static void spl_array_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) /* {{{ */
+static void spl_array_unset_property(zval *object, zval *member, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = Z_SPLARRAY_P(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !std_object_handlers.has_property(object, member, 2, key TSRMLS_CC)) {
+ && !std_object_handlers.has_property(object, member, 2, cache_slot TSRMLS_CC)) {
spl_array_unset_dimension(object, member TSRMLS_CC);
spl_array_rewind(intern TSRMLS_CC); /* because deletion might invalidate position */
return;
}
- std_object_handlers.unset_property(object, member, key TSRMLS_CC);
+ std_object_handlers.unset_property(object, member, cache_slot TSRMLS_CC);
} /* }}} */
static int spl_array_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 0400332dc4..9c80be4aaa 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -653,7 +653,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem
}
/* }}} */
-zend_function *spl_filesystem_object_get_method_check(zend_object **object, zend_string *method, const struct _zend_literal *key TSRMLS_DC) /* {{{ */
+zend_function *spl_filesystem_object_get_method_check(zend_object **object, zend_string *method, const zval *key TSRMLS_DC) /* {{{ */
{
spl_filesystem_object *fsobj = spl_filesystem_from_obj(*object);
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index a227b82ffd..7bc67ec300 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -828,7 +828,7 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth)
}
} /* }}} */
-static union _zend_function *spl_recursive_it_get_method(zend_object **zobject, zend_string *method, const zend_literal *key TSRMLS_DC)
+static union _zend_function *spl_recursive_it_get_method(zend_object **zobject, zend_string *method, const zval *key TSRMLS_DC)
{
union _zend_function *function_handler;
spl_recursive_it_object *object = spl_recursive_it_from_obj(*zobject);
@@ -1272,7 +1272,7 @@ static int spl_dual_it_gets_implemented(zend_class_entry *interface, zend_class_
}
#endif
-static union _zend_function *spl_dual_it_get_method(zend_object **object, zend_string *method, const zend_literal *key TSRMLS_DC)
+static union _zend_function *spl_dual_it_get_method(zend_object **object, zend_string *method, const zval *key TSRMLS_DC)
{
union _zend_function *function_handler;
spl_dual_it_object *intern;
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 20ad3d9986..03c77fea80 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -281,17 +281,12 @@ static int php_count_recursive(zval *array, long mode TSRMLS_DC) /* {{{ */
cnt = zend_hash_num_elements(Z_ARRVAL_P(array));
if (mode == COUNT_RECURSIVE) {
- HashPosition pos;
-
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos);
- (element = zend_hash_get_current_data_ex(Z_ARRVAL_P(array), &pos)) != NULL;
- zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos)
- ) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(array), element) {
Z_ARRVAL_P(array)->nApplyCount++;
ZVAL_DEREF(element);
cnt += php_count_recursive(element, COUNT_RECURSIVE TSRMLS_CC);
Z_ARRVAL_P(array)->nApplyCount--;
- }
+ } ZEND_HASH_FOREACH_END();
}
}
@@ -1218,7 +1213,8 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{
*array, /* array to check in */
*entry, /* pointer to array entry */
res; /* comparison result */
- HashPosition pos; /* hash iterator */
+ ulong num_idx;
+ zend_string *str_idx;
zend_bool strict = 0; /* strict comparison or not */
int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function;
@@ -1230,19 +1226,21 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{
is_equal_func = is_identical_function;
}
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos);
- while ((entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(array), &pos)) != NULL) {
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
is_equal_func(&res, value, entry TSRMLS_CC);
if (Z_LVAL(res)) {
if (behavior == 0) {
RETURN_TRUE;
} else {
- zend_hash_get_current_key_zval_ex(Z_ARRVAL_P(array), return_value, &pos);
+ if (str_idx) {
+ RETVAL_STR(STR_COPY(str_idx));
+ } else {
+ RETVAL_LONG(num_idx);
+ }
return;
}
}
- zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
RETURN_FALSE;
}
@@ -1324,9 +1322,8 @@ PHP_FUNCTION(extract)
zval *entry, data;
zend_string *var_name;
ulong num_key;
- int var_exists, key_type, count = 0;
+ int var_exists, count = 0;
int extract_refs = 0;
- HashPosition pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|lz/", &var_array, &extract_type, &prefix) == FAILURE) {
return;
@@ -1364,26 +1361,15 @@ PHP_FUNCTION(extract)
SEPARATE_ARG_IF_REF(var_array);
}
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(var_array), &pos);
- while ((entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(var_array), &pos)) != NULL) {
+ ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(var_array), num_key, var_name, entry) {
zval final_name;
- if (Z_TYPE_P(entry) == IS_INDIRECT) {
- entry = Z_INDIRECT_P(entry);
- if (Z_TYPE_P(entry) == IS_UNDEF) {
- zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos);
- continue;
- }
- }
-
ZVAL_NULL(&final_name);
-
- key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(var_array), &var_name, &num_key, 0, &pos);
var_exists = 0;
- if (key_type == HASH_KEY_IS_STRING) {
+ if (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)) {
+ } else if (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID) {
zval num;
ZVAL_LONG(&num, num_key);
@@ -1391,7 +1377,6 @@ PHP_FUNCTION(extract)
php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRLEN(num), 1 TSRMLS_CC);
zval_dtor(&num);
} else {
- zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos);
continue;
}
@@ -1469,9 +1454,7 @@ PHP_FUNCTION(extract)
count++;
}
zval_dtor(&final_name);
-
- zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
if (!extract_refs) {
zval_ptr_dtor(var_array);
@@ -1492,8 +1475,6 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu
zend_hash_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data);
}
} else if (Z_TYPE_P(entry) == IS_ARRAY) {
- HashPosition pos;
-
if ((Z_ARRVAL_P(entry)->nApplyCount > 1)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
return;
@@ -1501,18 +1482,9 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu
Z_ARRVAL_P(entry)->nApplyCount++;
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(entry), &pos);
- while ((value_ptr = zend_hash_get_current_data_ex(Z_ARRVAL_P(entry), &pos)) != NULL) {
- if (Z_TYPE_P(value_ptr) == IS_INDIRECT) {
- value_ptr = Z_INDIRECT_P(value_ptr);
- if (Z_TYPE_P(value_ptr) == IS_UNDEF) {
- zend_hash_move_forward_ex(Z_ARRVAL_P(entry), &pos);
- continue;
- }
- }
+ ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL_P(entry), value_ptr) {
php_compact_var(eg_active_symbol_table, return_value, value_ptr TSRMLS_CC);
- zend_hash_move_forward_ex(Z_ARRVAL_P(entry), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
Z_ARRVAL_P(entry)->nApplyCount--;
}
}
@@ -1592,7 +1564,6 @@ PHP_FUNCTION(array_fill)
PHP_FUNCTION(array_fill_keys)
{
zval *keys, *val, *entry;
- HashPosition pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "az", &keys, &val) == FAILURE) {
return;
@@ -1601,8 +1572,7 @@ PHP_FUNCTION(array_fill_keys)
/* Initialize return array */
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(keys)));
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(keys), &pos);
- while ((entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(keys), &pos)) != NULL) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(keys), entry) {
ZVAL_DEREF(entry);
if (Z_TYPE_P(entry) == IS_LONG) {
zval_add_ref(val);
@@ -1623,9 +1593,7 @@ PHP_FUNCTION(array_fill_keys)
zval_dtor(&key);
}
}
-
- zend_hash_move_forward_ex(Z_ARRVAL_P(keys), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -2007,21 +1975,34 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
/* Get the first or last value and copy it into the return value */
if (off_the_end) {
zend_hash_internal_pointer_end(Z_ARRVAL_P(stack));
+ while (1) {
+ val = zend_hash_get_current_data(Z_ARRVAL_P(stack));
+ if (!val) {
+ return;
+ } else if (Z_TYPE_P(val) == IS_INDIRECT) {
+ val = Z_INDIRECT_P(val);
+ if (Z_TYPE_P(val) == IS_UNDEF) {
+ zend_hash_move_backwards(Z_ARRVAL_P(stack));
+ continue;
+ }
+ }
+ break;
+ }
} else {
zend_hash_internal_pointer_reset(Z_ARRVAL_P(stack));
- }
- while (1) {
- val = zend_hash_get_current_data(Z_ARRVAL_P(stack));
- if (!val) {
- return;
- } else if (Z_TYPE_P(val) == IS_INDIRECT) {
- val = Z_INDIRECT_P(val);
- if (Z_TYPE_P(val) == IS_UNDEF) {
- zend_hash_move_forward(Z_ARRVAL_P(stack));
- continue;
+ while (1) {
+ val = zend_hash_get_current_data(Z_ARRVAL_P(stack));
+ if (!val) {
+ return;
+ } else if (Z_TYPE_P(val) == IS_INDIRECT) {
+ val = Z_INDIRECT_P(val);
+ if (Z_TYPE_P(val) == IS_UNDEF) {
+ zend_hash_move_forward(Z_ARRVAL_P(stack));
+ continue;
+ }
}
+ break;
}
- break;
}
RETVAL_ZVAL_FAST(val);
@@ -2209,7 +2190,6 @@ PHP_FUNCTION(array_slice)
pos; /* Current position in the array */
zend_string *string_key;
ulong num_key;
- HashPosition hpos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|zb", &input, &offset, &z_length, &preserve_keys) == FAILURE) {
return;
@@ -2250,33 +2230,28 @@ PHP_FUNCTION(array_slice)
/* Start at the beginning and go until we hit offset */
pos = 0;
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &hpos);
- while (pos < offset && (entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(input), &hpos)) != NULL) {
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_key, string_key, entry) {
pos++;
- zend_hash_move_forward_ex(Z_ARRVAL_P(input), &hpos);
- }
-
- /* Copy elements from input array to the one that's returned */
- while (pos < offset + length && (entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(input), &hpos)) != NULL) {
+ if (pos <= offset) {
+ continue;
+ }
+ if (pos > offset + length) {
+ break;
+ }
+ /* Copy elements from input array to the one that's returned */
zval_add_ref(entry);
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &num_key, 0, &hpos)) {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key, entry);
- break;
-
- case HASH_KEY_IS_LONG:
- if (preserve_keys) {
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry);
- } else {
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry);
- }
- break;
+ if (string_key) {
+ zend_hash_update(Z_ARRVAL_P(return_value), string_key, entry);
+ } else {
+ if (preserve_keys) {
+ zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry);
+ } else {
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry);
+ }
}
- pos++;
- zend_hash_move_forward_ex(Z_ARRVAL_P(input), &hpos);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -2285,87 +2260,80 @@ PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS
zval *src_entry, *dest_entry;
zend_string *string_key;
ulong num_key;
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(src, &pos);
- while ((src_entry = zend_hash_get_current_data_ex(src, &pos)) != NULL) {
- switch (zend_hash_get_current_key_ex(src, &string_key, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- if (recursive && (dest_entry = zend_hash_find(dest, string_key)) != NULL) {
- zval *src_zval = src_entry;
- zval *dest_zval = dest_entry;
- HashTable *thash;
- zval tmp;
+
+ ZEND_HASH_FOREACH_KEY_VAL(src, num_key, string_key, src_entry) {
+ if (string_key) {
+ if (recursive && (dest_entry = zend_hash_find(dest, string_key)) != NULL) {
+ zval *src_zval = src_entry;
+ zval *dest_zval = dest_entry;
+ HashTable *thash;
+ zval tmp;
- ZVAL_DEREF(src_zval);
- ZVAL_DEREF(dest_zval);
- thash = Z_TYPE_P(dest_zval) == IS_ARRAY ? Z_ARRVAL_P(dest_zval) : NULL;
- if ((thash && thash->nApplyCount > 1) || (src_entry == dest_entry && Z_ISREF_P(dest_entry) && (Z_REFCOUNT_P(dest_entry) % 2))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
- return 0;
- }
+ ZVAL_DEREF(src_zval);
+ ZVAL_DEREF(dest_zval);
+ thash = Z_TYPE_P(dest_zval) == IS_ARRAY ? Z_ARRVAL_P(dest_zval) : NULL;
+ if ((thash && thash->nApplyCount > 1) || (src_entry == dest_entry && Z_ISREF_P(dest_entry) && (Z_REFCOUNT_P(dest_entry) % 2))) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
+ return 0;
+ }
- if (Z_ISREF_P(dest_entry)) {
- if (Z_REFCOUNT_P(dest_entry) == 1) {
- ZVAL_UNREF(dest_entry);
- } else {
- Z_DELREF_P(dest_entry);
- ZVAL_DUP(dest_entry, dest_zval);
- }
- dest_zval = dest_entry;
+ if (Z_ISREF_P(dest_entry)) {
+ if (Z_REFCOUNT_P(dest_entry) == 1) {
+ ZVAL_UNREF(dest_entry);
} else {
- SEPARATE_ZVAL(dest_zval);
+ Z_DELREF_P(dest_entry);
+ ZVAL_DUP(dest_entry, dest_zval);
}
+ dest_zval = dest_entry;
+ } else {
+ SEPARATE_ZVAL(dest_zval);
+ }
- if (Z_TYPE_P(dest_zval) == IS_NULL) {
- convert_to_array_ex(dest_zval);
- add_next_index_null(dest_zval);
- } else {
- convert_to_array_ex(dest_zval);
- }
- ZVAL_UNDEF(&tmp);
- if (Z_TYPE_P(src_zval) == IS_OBJECT) {
- ZVAL_DUP(&tmp, src_zval);
- convert_to_array(&tmp);
- src_zval = &tmp;
+ if (Z_TYPE_P(dest_zval) == IS_NULL) {
+ convert_to_array_ex(dest_zval);
+ add_next_index_null(dest_zval);
+ } else {
+ convert_to_array_ex(dest_zval);
+ }
+ ZVAL_UNDEF(&tmp);
+ if (Z_TYPE_P(src_zval) == IS_OBJECT) {
+ ZVAL_DUP(&tmp, src_zval);
+ convert_to_array(&tmp);
+ src_zval = &tmp;
+ }
+ if (Z_TYPE_P(src_zval) == IS_ARRAY) {
+ if (thash) {
+ thash->nApplyCount++;
}
- if (Z_TYPE_P(src_zval) == IS_ARRAY) {
- if (thash) {
- thash->nApplyCount++;
- }
- if (!php_array_merge(Z_ARRVAL_P(dest_zval), Z_ARRVAL_P(src_zval), recursive TSRMLS_CC)) {
- if (thash) {
- thash->nApplyCount--;
- }
- return 0;
- }
+ if (!php_array_merge(Z_ARRVAL_P(dest_zval), Z_ARRVAL_P(src_zval), recursive TSRMLS_CC)) {
if (thash) {
thash->nApplyCount--;
}
- } else {
- if (Z_REFCOUNTED_P(src_entry)) {
- Z_ADDREF_P(src_entry);
- }
- zend_hash_next_index_insert(Z_ARRVAL_P(dest_zval), src_zval);
+ return 0;
+ }
+ if (thash) {
+ thash->nApplyCount--;
}
- zval_ptr_dtor(&tmp);
} else {
if (Z_REFCOUNTED_P(src_entry)) {
Z_ADDREF_P(src_entry);
}
- zend_hash_update(dest, string_key, src_entry);
+ zend_hash_next_index_insert(Z_ARRVAL_P(dest_zval), src_zval);
}
- break;
-
- case HASH_KEY_IS_LONG:
+ zval_ptr_dtor(&tmp);
+ } else {
if (Z_REFCOUNTED_P(src_entry)) {
Z_ADDREF_P(src_entry);
}
- zend_hash_next_index_insert(dest, src_entry);
- break;
+ zend_hash_update(dest, string_key, src_entry);
+ }
+ } else {
+ if (Z_REFCOUNTED_P(src_entry)) {
+ Z_ADDREF_P(src_entry);
+ }
+ zend_hash_next_index_insert(dest, src_entry);
}
- zend_hash_move_forward_ex(src, &pos);
- }
+ } ZEND_HASH_FOREACH_END();
return 1;
}
/* }}} */
@@ -2375,44 +2343,36 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC
zval *src_entry, *dest_entry, *src_zval, *dest_zval;
zend_string *string_key;
ulong num_key;
- HashPosition pos;
-
- for (zend_hash_internal_pointer_reset_ex(src, &pos);
- (src_entry = zend_hash_get_current_data_ex(src, &pos)) != NULL;
- zend_hash_move_forward_ex(src, &pos)) {
+ ZEND_HASH_FOREACH_KEY_VAL(src, num_key, string_key, src_entry) {
src_zval = src_entry;
ZVAL_DEREF(src_zval);
- switch (zend_hash_get_current_key_ex(src, &string_key, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- if (Z_TYPE_P(src_zval) != IS_ARRAY ||
- (dest_entry = zend_hash_find(dest, string_key)) == NULL ||
- (Z_TYPE_P(dest_entry) != IS_ARRAY &&
- (!Z_ISREF_P(dest_entry) || Z_TYPE_P(Z_REFVAL_P(dest_entry)) != IS_ARRAY))) {
-
- if (Z_REFCOUNTED_P(src_entry)) {
- Z_ADDREF_P(src_entry);
- }
- zend_hash_update(dest, string_key, src_entry);
+ if (string_key) {
+ if (Z_TYPE_P(src_zval) != IS_ARRAY ||
+ (dest_entry = zend_hash_find(dest, string_key)) == NULL ||
+ (Z_TYPE_P(dest_entry) != IS_ARRAY &&
+ (!Z_ISREF_P(dest_entry) || Z_TYPE_P(Z_REFVAL_P(dest_entry)) != IS_ARRAY))) {
- continue;
+ if (Z_REFCOUNTED_P(src_entry)) {
+ Z_ADDREF_P(src_entry);
}
- break;
-
- case HASH_KEY_IS_LONG:
- if (Z_TYPE_P(src_zval) != IS_ARRAY ||
- (dest_entry = zend_hash_index_find(dest, num_key)) == NULL ||
- (Z_TYPE_P(dest_entry) != IS_ARRAY &&
- (!Z_ISREF_P(dest_entry) || Z_TYPE_P(Z_REFVAL_P(dest_entry)) != IS_ARRAY))) {
+ zend_hash_update(dest, string_key, src_entry);
- if (Z_REFCOUNTED_P(src_entry)) {
- Z_ADDREF_P(src_entry);
- }
- zend_hash_index_update(dest, num_key, src_entry);
+ continue;
+ }
+ } else {
+ if (Z_TYPE_P(src_zval) != IS_ARRAY ||
+ (dest_entry = zend_hash_index_find(dest, num_key)) == NULL ||
+ (Z_TYPE_P(dest_entry) != IS_ARRAY &&
+ (!Z_ISREF_P(dest_entry) || Z_TYPE_P(Z_REFVAL_P(dest_entry)) != IS_ARRAY))) {
- continue;
+ if (Z_REFCOUNTED_P(src_entry)) {
+ Z_ADDREF_P(src_entry);
}
- break;
+ zend_hash_index_update(dest, num_key, src_entry);
+
+ continue;
+ }
}
dest_zval = dest_entry;
@@ -2435,7 +2395,7 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC
}
Z_ARRVAL_P(dest_zval)->nApplyCount--;
Z_ARRVAL_P(src_zval)->nApplyCount--;
- }
+ } ZEND_HASH_FOREACH_END();
return 1;
}
@@ -2526,7 +2486,8 @@ PHP_FUNCTION(array_keys)
new_val; /* New value */
int add_key; /* Flag to indicate whether a key should be added */
zend_bool strict = 0; /* do strict comparison */
- HashPosition pos;
+ ulong num_idx;
+ zend_string *str_idx;
int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|zb", &input, &search_value, &strict) == FAILURE) {
@@ -2546,20 +2507,21 @@ PHP_FUNCTION(array_keys)
add_key = 1;
/* Go through input array and add keys to the return array */
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos);
- while ((entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(input), &pos)) != NULL) {
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_idx, str_idx, entry) {
if (search_value != NULL) {
is_equal_func(&res, search_value, entry TSRMLS_CC);
add_key = zval_is_true(&res);
}
if (add_key) {
- zend_hash_get_current_key_zval_ex(Z_ARRVAL_P(input), &new_val, &pos);
+ if (str_idx) {
+ ZVAL_STR(&new_val, STR_COPY(str_idx));
+ } else {
+ ZVAL_LONG(&new_val, num_idx);
+ }
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &new_val);
}
-
- zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -2569,7 +2531,6 @@ PHP_FUNCTION(array_values)
{
zval *input, /* Input array */
*entry; /* An entry in the input array */
- HashPosition pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) == FAILURE) {
return;
@@ -2579,12 +2540,10 @@ PHP_FUNCTION(array_values)
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(input)));
/* Go through input array and add values to the return array */
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos);
- while ((entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(input), &pos)) != NULL) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(input), entry) {
zval_add_ref(entry);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry);
- zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -2596,7 +2555,6 @@ PHP_FUNCTION(array_count_values)
*entry, /* An entry in the input array */
*tmp;
HashTable *myht;
- HashPosition pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) == FAILURE) {
return;
@@ -2607,8 +2565,7 @@ PHP_FUNCTION(array_count_values)
/* Go through input array and add values to the return array */
myht = Z_ARRVAL_P(input);
- zend_hash_internal_pointer_reset_ex(myht, &pos);
- while ((entry = zend_hash_get_current_data_ex(myht, &pos)) != NULL) {
+ ZEND_HASH_FOREACH_VAL(myht, entry) {
if (Z_TYPE_P(entry) == IS_LONG) {
if ((tmp = zend_hash_index_find(Z_ARRVAL_P(return_value), Z_LVAL_P(entry))) == NULL) {
zval data;
@@ -2628,9 +2585,7 @@ PHP_FUNCTION(array_count_values)
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only count STRING and INTEGER values!");
}
-
- zend_hash_move_forward_ex(myht, &pos);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -2666,7 +2621,6 @@ PHP_FUNCTION(array_column)
{
zval *zcolumn = NULL, *zkey = NULL, *data;
HashTable *arr_hash;
- HashPosition pointer;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "hz!|z!", &arr_hash, &zcolumn, &zkey) == FAILURE) {
return;
@@ -2678,9 +2632,7 @@ PHP_FUNCTION(array_column)
}
array_init(return_value);
- for (zend_hash_internal_pointer_reset_ex(arr_hash, &pointer);
- (data = zend_hash_get_current_data_ex(arr_hash, &pointer)) != NULL;
- zend_hash_move_forward_ex(arr_hash, &pointer)) {
+ ZEND_HASH_FOREACH_VAL(arr_hash, data) {
zval *zcolval, *zkeyval = NULL;
HashTable *ht;
@@ -2726,7 +2678,7 @@ PHP_FUNCTION(array_column)
} else {
add_next_index_zval(return_value, zcolval);
}
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -2739,7 +2691,6 @@ PHP_FUNCTION(array_reverse)
zend_string *string_key;
ulong num_key;
zend_bool preserve_keys = 0; /* whether to preserve keys */
- HashPosition pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|b", &input, &preserve_keys) == FAILURE) {
return;
@@ -2748,26 +2699,19 @@ PHP_FUNCTION(array_reverse)
/* Initialize return array */
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(input)));
- zend_hash_internal_pointer_end_ex(Z_ARRVAL_P(input), &pos);
- while ((entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(input), &pos)) != NULL) {
+ ZEND_HASH_REVERSE_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_key, string_key, entry) {
zval_add_ref(entry);
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key, entry);
- break;
-
- case HASH_KEY_IS_LONG:
- if (preserve_keys) {
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry);
- } else {
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry);
- }
- break;
+ if (string_key) {
+ zend_hash_update(Z_ARRVAL_P(return_value), string_key, entry);
+ } else {
+ if (preserve_keys) {
+ zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry);
+ } else {
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry);
+ }
}
-
- zend_hash_move_backwards_ex(Z_ARRVAL_P(input), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -2844,7 +2788,8 @@ PHP_FUNCTION(array_pad)
PHP_FUNCTION(array_flip)
{
zval *array, *entry, data;
- HashPosition pos;
+ ulong num_idx;
+ zend_string *str_idx;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) {
return;
@@ -2852,21 +2797,25 @@ PHP_FUNCTION(array_flip)
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(array)));
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos);
- while ((entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(array), &pos)) != NULL) {
- zend_hash_get_current_key_zval_ex(Z_ARRVAL_P(array), &data, &pos);
-
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
if (Z_TYPE_P(entry) == IS_LONG) {
+ if (str_idx) {
+ ZVAL_STR(&data, STR_COPY(str_idx));
+ } else {
+ ZVAL_LONG(&data, num_idx);
+ }
zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data);
} else if (Z_TYPE_P(entry) == IS_STRING) {
+ if (str_idx) {
+ ZVAL_STR(&data, STR_COPY(str_idx));
+ } else {
+ ZVAL_LONG(&data, num_idx);
+ }
zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data);
} else {
- zval_ptr_dtor(&data); /* will free also zval structure */
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only flip STRING and INTEGER values!");
}
-
- zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -2879,7 +2828,6 @@ PHP_FUNCTION(array_change_key_case)
zend_string *new_key;
ulong num_key;
long change_to_upper=0;
- HashPosition pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &change_to_upper) == FAILURE) {
return;
@@ -2887,28 +2835,22 @@ PHP_FUNCTION(array_change_key_case)
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(array)));
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos);
- while ((entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(array), &pos)) != NULL) {
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_key, string_key, entry) {
zval_add_ref(entry);
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(array), &string_key, &num_key, 0, &pos)) {
- case HASH_KEY_IS_LONG:
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry);
- break;
- case HASH_KEY_IS_STRING:
- new_key = STR_INIT(string_key->val, string_key->len, 0);
- if (change_to_upper) {
- php_strtoupper(new_key->val, new_key->len);
- } else {
- php_strtolower(new_key->val, new_key->len);
- }
- zend_hash_update(Z_ARRVAL_P(return_value), new_key, entry);
- STR_RELEASE(new_key);
- break;
+ if (!string_key) {
+ zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry);
+ } else {
+ new_key = STR_INIT(string_key->val, string_key->len, 0);
+ if (change_to_upper) {
+ php_strtoupper(new_key->val, new_key->len);
+ } else {
+ php_strtolower(new_key->val, new_key->len);
+ }
+ zend_hash_update(Z_ARRVAL_P(return_value), new_key, entry);
+ STR_RELEASE(new_key);
}
-
- zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -4116,10 +4058,9 @@ PHP_FUNCTION(array_rand)
{
zval *input;
long randval, num_req = 1;
- int num_avail, key_type;
+ int num_avail;
zend_string *string_key;
ulong num_key;
- HashPosition pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &input, &num_req) == FAILURE) {
return;
@@ -4140,22 +4081,24 @@ PHP_FUNCTION(array_rand)
}
/* We can't use zend_hash_index_find() because the array may have string keys or gaps. */
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos);
- while (num_req && (key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &num_key, 0, &pos)) != HASH_KEY_NON_EXISTENT) {
+ ZEND_HASH_FOREACH_KEY(Z_ARRVAL_P(input), num_key, string_key) {
+ if (!num_req) {
+ break;
+ }
randval = php_rand(TSRMLS_C);
if ((double) (randval / (PHP_RAND_MAX + 1.0)) < (double) num_req / (double) num_avail) {
/* If we are returning a single result, just do it. */
if (Z_TYPE_P(return_value) != IS_ARRAY) {
- if (key_type == HASH_KEY_IS_STRING) {
+ if (string_key) {
RETURN_STR(STR_COPY(string_key));
} else {
RETURN_LONG(num_key);
}
} else {
/* Append the result to the return value. */
- if (key_type == HASH_KEY_IS_STRING) {
+ if (string_key) {
add_next_index_str(return_value, STR_COPY(string_key));
} else {
add_next_index_long(return_value, num_key);
@@ -4164,8 +4107,7 @@ PHP_FUNCTION(array_rand)
num_req--;
}
num_avail--;
- zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -4176,7 +4118,6 @@ PHP_FUNCTION(array_sum)
zval *input,
*entry,
entry_n;
- HashPosition pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) == FAILURE) {
return;
@@ -4184,17 +4125,14 @@ PHP_FUNCTION(array_sum)
ZVAL_LONG(return_value, 0);
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos);
- (entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(input), &pos)) != NULL;
- zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos)
- ) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(input), entry) {
if (Z_TYPE_P(entry) == IS_ARRAY || Z_TYPE_P(entry) == IS_OBJECT) {
continue;
}
ZVAL_DUP(&entry_n, entry);
convert_scalar_to_number(&entry_n TSRMLS_CC);
fast_add_function(return_value, return_value, &entry_n TSRMLS_CC);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -4205,7 +4143,6 @@ PHP_FUNCTION(array_product)
zval *input,
*entry,
entry_n;
- HashPosition pos;
double dval;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) == FAILURE) {
@@ -4217,10 +4154,7 @@ PHP_FUNCTION(array_product)
return;
}
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos);
- (entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(input), &pos)) != NULL;
- zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos)
- ) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(input), entry) {
if (Z_TYPE_P(entry) == IS_ARRAY || Z_TYPE_P(entry) == IS_OBJECT) {
continue;
}
@@ -4237,7 +4171,7 @@ PHP_FUNCTION(array_product)
convert_to_double(return_value);
convert_to_double(&entry_n);
Z_DVAL_P(return_value) *= Z_DVAL(entry_n);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -4253,7 +4187,6 @@ PHP_FUNCTION(array_reduce)
zend_fcall_info fci;
zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
zval *initial = NULL;
- HashPosition pos;
HashTable *htbl;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "af|z", &input, &fci, &fci_cache, &initial) == FAILURE) {
@@ -4280,8 +4213,7 @@ PHP_FUNCTION(array_reduce)
fci.param_count = 2;
fci.no_separation = 0;
- zend_hash_internal_pointer_reset_ex(htbl, &pos);
- while ((operand = zend_hash_get_current_data_ex(htbl, &pos)) != NULL) {
+ ZEND_HASH_FOREACH_VAL(htbl, operand) {
ZVAL_COPY_VALUE(&args[0], &result);
ZVAL_COPY_VALUE(&args[1], operand);
fci.params = args;
@@ -4293,8 +4225,8 @@ PHP_FUNCTION(array_reduce)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the reduction callback");
return;
}
- zend_hash_move_forward_ex(htbl, &pos);
- }
+ } ZEND_HASH_FOREACH_END();
+
RETVAL_ZVAL(&result, 1, 1);
}
/* }}} */
@@ -4313,7 +4245,6 @@ PHP_FUNCTION(array_filter)
zend_fcall_info fci = empty_fcall_info;
zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
ulong num_key;
- HashPosition pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|fl", &array, &fci, &fci_cache, &use_type) == FAILURE) {
return;
@@ -4331,32 +4262,23 @@ PHP_FUNCTION(array_filter)
fci.param_count = 1;
}
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos);
- (operand = zend_hash_get_current_data_ex(Z_ARRVAL_P(array), &pos)) != NULL;
- zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos)
- ) {
- int key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(array), &string_key, &num_key, 0, &pos);
-
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_key, string_key, operand) {
if (have_callback) {
if (use_type) {
/* Set up the key */
- switch (key_type) {
- case HASH_KEY_IS_LONG:
- if (use_type == ARRAY_FILTER_USE_BOTH) {
- fci.param_count = 2;
- ZVAL_LONG(&args[1], num_key);
- } else if (use_type == ARRAY_FILTER_USE_KEY) {
- ZVAL_LONG(&args[0], num_key);
- }
- break;
-
- case HASH_KEY_IS_STRING:
- if (use_type == ARRAY_FILTER_USE_BOTH) {
- ZVAL_STR(&args[1], STR_COPY(string_key));
- } else if (use_type == ARRAY_FILTER_USE_KEY) {
- ZVAL_STR(&args[0], STR_COPY(string_key));
- }
- break;
+ if (!string_key) {
+ if (use_type == ARRAY_FILTER_USE_BOTH) {
+ fci.param_count = 2;
+ ZVAL_LONG(&args[1], num_key);
+ } else if (use_type == ARRAY_FILTER_USE_KEY) {
+ ZVAL_LONG(&args[0], num_key);
+ }
+ } else {
+ if (use_type == ARRAY_FILTER_USE_BOTH) {
+ ZVAL_STR(&args[1], STR_COPY(string_key));
+ } else if (use_type == ARRAY_FILTER_USE_KEY) {
+ ZVAL_STR(&args[0], STR_COPY(string_key));
+ }
}
}
if (use_type != ARRAY_FILTER_USE_KEY) {
@@ -4392,16 +4314,12 @@ PHP_FUNCTION(array_filter)
}
zval_add_ref(operand);
- switch (key_type) {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key, operand);
- break;
-
- case HASH_KEY_IS_LONG:
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, operand);
- break;
+ if (string_key) {
+ zend_hash_update(Z_ARRVAL_P(return_value), string_key, operand);
+ } else {
+ zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, operand);
}
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -4584,7 +4502,6 @@ PHP_FUNCTION(array_chunk)
zval *input = NULL;
zval chunk;
zval *entry;
- HashPosition pos;
if (zend_parse_parameters(argc TSRMLS_CC, "al|b", &input, &size, &preserve_keys) == FAILURE) {
return;
@@ -4604,8 +4521,8 @@ PHP_FUNCTION(array_chunk)
array_init_size(return_value, ((num_in - 1) / size) + 1);
ZVAL_UNDEF(&chunk);
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos);
- while ((entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(input), &pos)) != NULL) {
+
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_key, str_key, entry) {
/* If new chunk, create and initialize it. */
if (Z_TYPE(chunk) == IS_UNDEF) {
array_init_size(&chunk, size);
@@ -4615,14 +4532,10 @@ PHP_FUNCTION(array_chunk)
zval_add_ref(entry);
if (preserve_keys) {
- key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &str_key, &num_key, 0, &pos);
- switch (key_type) {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL(chunk), str_key, entry);
- break;
- default:
- add_index_zval(&chunk, num_key, entry);
- break;
+ if (str_key) {
+ zend_hash_update(Z_ARRVAL(chunk), str_key, entry);
+ } else {
+ add_index_zval(&chunk, num_key, entry);
}
} else {
add_next_index_zval(&chunk, entry);
@@ -4634,9 +4547,7 @@ PHP_FUNCTION(array_chunk)
add_next_index_zval(return_value, &chunk);
ZVAL_UNDEF(&chunk);
}
-
- zend_hash_move_forward_ex(Z_ARRVAL_P(input), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
/* Add the final chunk if there is one. */
if (Z_TYPE(chunk) != IS_UNDEF) {
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 9d6878817e..bf9a5a94db 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -4281,11 +4281,8 @@ PHP_FUNCTION(getopt)
* and a trailing NULL */
argv = (char **) safe_emalloc(sizeof(char *), (argc + 1), 0);
- /* Reset the array indexes. */
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(args));
-
/* Iterate over the hash to construct the argv array. */
- while ((entry = zend_hash_get_current_data(Z_ARRVAL_P(args))) != NULL) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(args), entry) {
zval arg, *arg_ptr = entry;
if (Z_TYPE_P(entry) != IS_STRING) {
@@ -4299,9 +4296,7 @@ PHP_FUNCTION(getopt)
if (arg_ptr != entry) {
zval_dtor(&arg);
}
-
- zend_hash_move_forward(Z_ARRVAL_P(args));
- }
+ } ZEND_HASH_FOREACH_END();
/* The C Standard requires argv[argc] to be NULL - this might
* keep some getopt implementations happy. */
@@ -4327,11 +4322,8 @@ PHP_FUNCTION(getopt)
memset(opts, 0, count * sizeof(opt_struct));
- /* Reset the array indexes. */
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts));
-
/* Iterate over the hash to construct the argv array. */
- while ((entry = zend_hash_get_current_data(Z_ARRVAL_P(p_longopts))) != NULL) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(p_longopts), entry) {
zval arg, *arg_ptr = entry;
if (Z_TYPE_P(entry) != IS_STRING) {
@@ -4357,9 +4349,7 @@ PHP_FUNCTION(getopt)
if (arg_ptr != entry) {
zval_dtor(&arg);
}
-
- zend_hash_move_forward(Z_ARRVAL_P(p_longopts));
- }
+ } ZEND_HASH_FOREACH_END();
} else {
opts = (opt_struct*) erealloc(opts, sizeof(opt_struct) * (len + 1));
orig_opts = opts;
@@ -4877,13 +4867,10 @@ PHP_FUNCTION(call_user_method_array)
num_elems = zend_hash_num_elements(params_ar);
method_args = (zval *) safe_emalloc(sizeof(zval), num_elems, 0);
- for (zend_hash_internal_pointer_reset(params_ar);
- (zv = zend_hash_get_current_data(params_ar)) != NULL;
- zend_hash_move_forward(params_ar)
- ) {
+ ZEND_HASH_FOREACH_VAL(params_ar, zv) {
ZVAL_COPY_VALUE(&method_args[element], zv);
element++;
- }
+ } ZEND_HASH_FOREACH_END();
if (call_user_function_ex(EG(function_table), object, callback, &retval, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS) {
if (Z_TYPE(retval) != IS_UNDEF) {
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 536cdfb269..75197463a1 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -647,10 +647,8 @@ PHP_FUNCTION(file_put_contents)
if (zend_hash_num_elements(Z_ARRVAL_P(data))) {
int bytes_written;
zval *tmp;
- HashPosition pos;
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(data), &pos);
- while ((tmp = zend_hash_get_current_data_ex(Z_ARRVAL_P(data), &pos)) != NULL) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(data), tmp) {
if (Z_TYPE_P(tmp) != IS_STRING) {
SEPARATE_ZVAL(tmp);
convert_to_string(tmp);
@@ -668,8 +666,7 @@ PHP_FUNCTION(file_put_contents)
break;
}
}
- zend_hash_move_forward_ex(Z_ARRVAL_P(data), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
}
break;
@@ -1084,10 +1081,11 @@ PHPAPI PHP_FUNCTION(fgetss)
size_t actual_len, retval_len;
char *buf = NULL, *retval;
php_stream *stream;
+ zend_string *allowed = NULL;
char *allowed_tags=NULL;
int allowed_tags_len=0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ls", &fd, &bytes, &allowed_tags, &allowed_tags_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lS", &fd, &bytes, &allowed) == FAILURE) {
RETURN_FALSE;
}
@@ -1112,8 +1110,24 @@ PHPAPI PHP_FUNCTION(fgetss)
RETURN_FALSE;
}
+ if (allowed != NULL) {
+// TODO: reimplement to avoid reallocation ???
+ if (IS_INTERNED(allowed)) {
+ allowed_tags = estrndup(allowed->val, allowed->len);
+ allowed_tags_len = allowed->len;
+ } else {
+ allowed_tags = allowed->val;
+ allowed_tags_len = allowed->len;
+ }
+ }
+
retval_len = php_strip_tags(retval, actual_len, &stream->fgetss_state, allowed_tags, allowed_tags_len);
+// TODO: reimplement to avoid reallocation ???
+ if (allowed && IS_INTERNED(allowed)) {
+ efree(allowed_tags);
+ }
+
// TODO: avoid reallocation ???
RETVAL_STRINGL(retval, retval_len);
efree(retval);
@@ -1865,11 +1879,9 @@ PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char en
int count, i = 0, ret;
zval *field_tmp = NULL, field;
smart_str csvline = {0};
- HashPosition pos;
count = zend_hash_num_elements(Z_ARRVAL_P(fields));
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(fields), &pos);
- while ((field_tmp = zend_hash_get_current_data_ex(Z_ARRVAL_P(fields), &pos)) != NULL) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(fields), field_tmp) {
ZVAL_COPY_VALUE(&field, field_tmp);
if (Z_TYPE(field) != IS_STRING) {
@@ -1910,12 +1922,10 @@ PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char en
if (++i != count) {
smart_str_appendl(&csvline, &delimiter, 1);
}
- zend_hash_move_forward_ex(Z_ARRVAL_P(fields), &pos);
-
if (Z_TYPE_P(field_tmp) != IS_STRING) {
zval_dtor(&field);
}
- }
+ } ZEND_HASH_FOREACH_END();
smart_str_appendc(&csvline, '\n');
smart_str_0(&csvline);
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 55737c97af..6897cde094 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -258,17 +258,14 @@ static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zv
if (filterparams != NULL) {
if (Z_TYPE_P(filterparams) == IS_ARRAY) {
- HashPosition pos;
zval *tmp;
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(filterparams), &pos);
- while ((tmp = zend_hash_get_current_data_ex(Z_ARRVAL_P(filterparams), &pos)) != NULL) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) {
convert_to_string_ex(tmp);
smart_str_appendc(&tags_ss, '<');
smart_str_appendl(&tags_ss, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
smart_str_appendc(&tags_ss, '>');
- zend_hash_move_forward_ex(Z_ARRVAL_P(filterparams), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
smart_str_0(&tags_ss);
} else {
/* FIXME: convert_to_* may clutter zvals and lead it into segfault ? */
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index 2e6e2f672b..622fbfbb3f 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -404,12 +404,10 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC)
newargs = (zval *)safe_emalloc(argc, sizeof(zval), 0);
ZVAL_COPY_VALUE(&newargs[0], z_format);
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(array));
- (zv = zend_hash_get_current_data(Z_ARRVAL_P(array))) != NULL;
- zend_hash_move_forward(Z_ARRVAL_P(array))) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(array), zv) {
ZVAL_COPY_VALUE(&newargs[i], zv);
i++;
- }
+ } ZEND_HASH_FOREACH_END();
args = newargs;
format_offset = 0;
}
diff --git a/ext/standard/http.c b/ext/standard/http.c
index 46af753ecc..b839a4cb97 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -33,7 +33,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
{
zend_string *key = NULL;
char *newprefix, *p, *prop_name;
- int arg_sep_len, key_type, newprefix_len, prop_len;
+ int arg_sep_len, newprefix_len, prop_len;
ulong idx;
zval *zdata = NULL, copyzval;
@@ -54,10 +54,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
}
arg_sep_len = strlen(arg_sep);
- for (zend_hash_internal_pointer_reset(ht);
- (key_type = zend_hash_get_current_key(ht, &key, &idx, 0)) != HASH_KEY_NON_EXISTENT;
- zend_hash_move_forward(ht)
- ) {
+ ZEND_HASH_FOREACH_KEY_VAL_IND(ht, idx, key, zdata) {
/* handling for private & protected object properties */
if (key) {
if (key->val[0] == '\0' && type != NULL) {
@@ -78,18 +75,8 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
prop_len = 0;
}
- if ((zdata = zend_hash_get_current_data(ht)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error traversing form data array");
- return FAILURE;
- }
- if (Z_TYPE_P(zdata) == IS_INDIRECT) {
- zdata = Z_INDIRECT_P(zdata);
- if (Z_TYPE_P(zdata) == IS_UNDEF) {
- continue;
- }
- }
if (Z_TYPE_P(zdata) == IS_ARRAY || Z_TYPE_P(zdata) == IS_OBJECT) {
- if (key_type == HASH_KEY_IS_STRING) {
+ if (key) {
zend_string *ekey;
if (enc_type == PHP_QUERY_RFC3986) {
ekey = php_raw_url_encode(prop_name, prop_len);
@@ -160,7 +147,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
}
/* Simple key=value */
smart_str_appendl(formstr, key_prefix, key_prefix_len);
- if (key_type == HASH_KEY_IS_STRING) {
+ if (key) {
zend_string *ekey;
if (enc_type == PHP_QUERY_RFC3986) {
ekey = php_raw_url_encode(prop_name, prop_len);
@@ -230,7 +217,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
}
}
}
- }
+ } ZEND_HASH_FOREACH_END();
return SUCCESS;
}
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 9e7a906ce2..7ac15a69ca 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -237,12 +237,9 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
char *s, *p;
if (Z_TYPE_P(tmpzval) == IS_ARRAY) {
- HashPosition pos;
zval *tmpheader = NULL;
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(tmpzval), &pos);
- NULL != (tmpheader = zend_hash_get_current_data_ex(Z_ARRVAL_P(tmpzval), &pos));
- zend_hash_move_forward_ex(Z_ARRVAL_P(tmpzval), &pos)) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(tmpzval), tmpheader) {
if (Z_TYPE_P(tmpheader) == IS_STRING) {
s = Z_STRVAL_P(tmpheader);
do {
@@ -266,7 +263,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
while (*s == '\r' || *s == '\n') s++;
} while (*s != 0);
}
- }
+ } ZEND_HASH_FOREACH_END();
} else if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval)) {
s = Z_STRVAL_P(tmpzval);
do {
@@ -423,19 +420,15 @@ finish:
tmp = NULL;
if (Z_TYPE_P(tmpzval) == IS_ARRAY) {
- HashPosition pos;
zval *tmpheader = NULL;
smart_str tmpstr = {0};
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(tmpzval), &pos);
- NULL != (tmpheader = zend_hash_get_current_data_ex(Z_ARRVAL_P(tmpzval), &pos));
- zend_hash_move_forward_ex(Z_ARRVAL_P(tmpzval), &pos)
- ) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(tmpzval), tmpheader) {
if (Z_TYPE_P(tmpheader) == IS_STRING) {
smart_str_appendl(&tmpstr, Z_STRVAL_P(tmpheader), Z_STRLEN_P(tmpheader));
smart_str_appendl(&tmpstr, "\r\n", sizeof("\r\n") - 1);
}
- }
+ } ZEND_HASH_FOREACH_END();
smart_str_0(&tmpstr);
/* Remove newlines and spaces from start and end. there's at least one extra \r\n at the end that needs to go. */
if (tmpstr.s) {
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
index c017edff89..0a08ad4929 100644
--- a/ext/standard/incomplete_class.c
+++ b/ext/standard/incomplete_class.c
@@ -49,7 +49,7 @@ static void incomplete_class_message(zval *object, int error_type TSRMLS_DC)
}
/* }}} */
-static zval *incomplete_class_get_property(zval *object, zval *member, int type, const zend_literal *key, zval *rv TSRMLS_DC) /* {{{ */
+static zval *incomplete_class_get_property(zval *object, zval *member, int type, zend_uint cache_slot, zval *rv TSRMLS_DC) /* {{{ */
{
incomplete_class_message(object, E_NOTICE TSRMLS_CC);
@@ -61,33 +61,33 @@ static zval *incomplete_class_get_property(zval *object, zval *member, int type,
}
/* }}} */
-static void incomplete_class_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) /* {{{ */
+static void incomplete_class_write_property(zval *object, zval *member, zval *value, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
incomplete_class_message(object, E_NOTICE TSRMLS_CC);
}
/* }}} */
-static zval *incomplete_class_get_property_ptr_ptr(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */
+static zval *incomplete_class_get_property_ptr_ptr(zval *object, zval *member, int type, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
incomplete_class_message(object, E_NOTICE TSRMLS_CC);
return &EG(error_zval);
}
/* }}} */
-static void incomplete_class_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) /* {{{ */
+static void incomplete_class_unset_property(zval *object, zval *member, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
incomplete_class_message(object, E_NOTICE TSRMLS_CC);
}
/* }}} */
-static int incomplete_class_has_property(zval *object, zval *member, int check_empty, const zend_literal *key TSRMLS_DC) /* {{{ */
+static int incomplete_class_has_property(zval *object, zval *member, int check_empty, zend_uint cache_slot TSRMLS_DC) /* {{{ */
{
incomplete_class_message(object, E_NOTICE TSRMLS_CC);
return 0;
}
/* }}} */
-static union _zend_function *incomplete_class_get_method(zend_object **object, zend_string *method, const zend_literal *key TSRMLS_DC) /* {{{ */
+static union _zend_function *incomplete_class_get_method(zend_object **object, zend_string *method, const zval *key TSRMLS_DC) /* {{{ */
{
zval zobject;
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index c18077a2d5..d5eb85d371 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -85,7 +85,6 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
uint cnt, l, sizeenv=0, el_len;
ulong num_key;
HashTable *target_hash;
- HashPosition pos;
memset(&env, 0, sizeof(env));
@@ -109,10 +108,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
}
/* first, we have to get the size of all the elements in the hash */
- for (zend_hash_internal_pointer_reset_ex(target_hash, &pos);
- (element = zend_hash_get_current_data_ex(target_hash, &pos)) != NULL;
- zend_hash_move_forward_ex(target_hash, &pos)) {
-
+ ZEND_HASH_FOREACH_KEY_VAL(target_hash, num_key, string_key, element) {
convert_to_string_ex(element);
el_len = Z_STRLEN_P(element);
if (el_len == 0) {
@@ -121,25 +117,20 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
sizeenv += el_len+1;
- switch (zend_hash_get_current_key_ex(target_hash, &string_key, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- if (string_key->len == 0) {
- continue;
- }
- sizeenv += string_key->len + 2;
- break;
+ if (string_key) {
+ if (string_key->len == 0) {
+ continue;
+ }
+ sizeenv += string_key->len + 2;
}
- }
+ } ZEND_HASH_FOREACH_END();
#ifndef PHP_WIN32
ep = env.envarray = (char **) pecalloc(cnt + 1, sizeof(char *), is_persistent);
#endif
p = env.envp = (char *) pecalloc(sizeenv + 4, 1, is_persistent);
- for (zend_hash_internal_pointer_reset_ex(target_hash, &pos);
- (element = zend_hash_get_current_data_ex(target_hash, &pos)) != NULL;
- zend_hash_move_forward_ex(target_hash, &pos)) {
-
+ ZEND_HASH_FOREACH_KEY_VAL(target_hash, num_key, string_key, element) {
convert_to_string_ex(element);
el_len = Z_STRLEN_P(element);
@@ -148,40 +139,34 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
}
data = Z_STRVAL_P(element);
- switch (zend_hash_get_current_key_ex(target_hash, &string_key, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- if (string_key->len == 0) {
- continue;
- }
- l = string_key->len + el_len + 2;
- memcpy(p, string_key->val, string_key->len);
- strncat(p, "=", 1);
- strncat(p, data, el_len);
+ if (string_key) {
+ if (string_key->len == 0) {
+ continue;
+ }
+
+ l = string_key->len + el_len + 2;
+ memcpy(p, string_key->val, string_key->len);
+ strncat(p, "=", 1);
+ strncat(p, data, el_len);
#ifndef PHP_WIN32
- *ep = p;
- ++ep;
+ *ep = p;
+ ++ep;
#endif
- p += l;
- break;
- case HASH_KEY_IS_LONG:
- memcpy(p,data,el_len);
+ p += l;
+ } else {
+ memcpy(p,data,el_len);
#ifndef PHP_WIN32
- *ep = p;
- ++ep;
+ *ep = p;
+ ++ep;
#endif
- p += el_len + 1;
- break;
- case HASH_KEY_NON_EXISTENT:
- break;
+ p += el_len + 1;
}
- }
+ } ZEND_HASH_FOREACH_END();
assert((uint)(p - env.envp) <= sizeenv);
- zend_hash_internal_pointer_reset_ex(target_hash, &pos);
-
return env;
}
/* }}} */
@@ -442,7 +427,8 @@ PHP_FUNCTION(proc_open)
int ndesc = 0;
int i;
zval *descitem = NULL;
- HashPosition pos;
+ zend_string *str_index;
+ ulong nindex;
struct php_proc_open_descriptor_item descriptors[PHP_PROC_OPEN_MAX_DESCRIPTORS];
#ifdef PHP_WIN32
PROCESS_INFORMATION pi;
@@ -519,15 +505,9 @@ PHP_FUNCTION(proc_open)
#endif
/* walk the descriptor spec and set up files/pipes */
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(descriptorspec), &pos);
- while ((descitem = zend_hash_get_current_data_ex(Z_ARRVAL_P(descriptorspec), &pos)) != NULL) {
- zend_string *str_index;
- ulong nindex;
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(descriptorspec), nindex, str_index, descitem) {
zval *ztype;
- str_index = NULL;
- zend_hash_get_current_key_ex(Z_ARRVAL_P(descriptorspec), &str_index, &nindex, 0, &pos);
-
if (str_index) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "descriptor spec must be an integer indexed array");
goto exit_fail;
@@ -685,10 +665,9 @@ PHP_FUNCTION(proc_open)
}
}
- zend_hash_move_forward_ex(Z_ARRVAL_P(descriptorspec), &pos);
if (++ndesc == PHP_PROC_OPEN_MAX_DESCRIPTORS)
break;
- }
+ } ZEND_HASH_FOREACH_END();
#ifdef PHP_WIN32
if (cwd == NULL) {
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index e668b973b4..c39a9f3310 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -555,14 +555,10 @@ PHP_FUNCTION(stream_get_transports)
}
if ((stream_xport_hash = php_stream_xport_get_hash())) {
- HashPosition pos;
array_init(return_value);
- zend_hash_internal_pointer_reset_ex(stream_xport_hash, &pos);
- while (zend_hash_get_current_key_ex(stream_xport_hash,
- &stream_xport, &num_key, 0, &pos) == HASH_KEY_IS_STRING) {
+ ZEND_HASH_FOREACH_KEY(stream_xport_hash, num_key, stream_xport) {
add_next_index_str(return_value, STR_COPY(stream_xport));
- zend_hash_move_forward_ex(stream_xport_hash, &pos);
- }
+ } ZEND_HASH_FOREACH_END();
} else {
RETURN_FALSE;
}
@@ -583,15 +579,12 @@ PHP_FUNCTION(stream_get_wrappers)
}
if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) {
- HashPosition pos;
array_init(return_value);
- for (zend_hash_internal_pointer_reset_ex(url_stream_wrappers_hash, &pos);
- (key_flags = zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &num_key, 0, &pos)) != HASH_KEY_NON_EXISTENT;
- zend_hash_move_forward_ex(url_stream_wrappers_hash, &pos)) {
- if (key_flags == HASH_KEY_IS_STRING) {
- add_next_index_str(return_value, STR_COPY(stream_protocol));
- }
- }
+ ZEND_HASH_FOREACH_KEY(url_stream_wrappers_hash, num_key, stream_protocol) {
+ if (key_flags == HASH_KEY_IS_STRING) {
+ add_next_index_str(return_value, STR_COPY(stream_protocol));
+ }
+ } ZEND_HASH_FOREACH_END();
} else {
RETURN_FALSE;
}
@@ -610,10 +603,7 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t
return 0;
}
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array));
- (elem = zend_hash_get_current_data(Z_ARRVAL_P(stream_array))) != NULL;
- zend_hash_move_forward(Z_ARRVAL_P(stream_array))) {
-
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(stream_array), elem) {
/* Temporary int fd is needed for the STREAM data type on windows, passing this_fd directly to php_stream_cast()
would eventually bring a wrong result on x64. php_stream_cast() casts to int internally, and this will leave
the higher bits of a SOCKET variable uninitialized on systems with little endian. */
@@ -639,7 +629,8 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t
}
cnt++;
}
- }
+ } ZEND_HASH_FOREACH_END();
+
return cnt ? 1 : 0;
}
@@ -648,6 +639,8 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
zval *elem, *dest_elem, new_array;
php_stream *stream;
int ret = 0;
+ zend_string *key;
+ ulong num_ind;
if (Z_TYPE_P(stream_array) != IS_ARRAY) {
return 0;
@@ -655,26 +648,12 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
ZVAL_NEW_ARR(&new_array);
zend_hash_init(Z_ARRVAL(new_array), zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0);
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array));
- zend_hash_has_more_elements(Z_ARRVAL_P(stream_array)) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(stream_array))) {
-
- int type;
- zend_string *key;
- ulong num_ind;
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(stream_array), num_ind, key, elem) {
/* Temporary int fd is needed for the STREAM data type on windows, passing this_fd directly to php_stream_cast()
would eventually bring a wrong result on x64. php_stream_cast() casts to int internally, and this will leave
the higher bits of a SOCKET variable uninitialized on systems with little endian. */
int tmp_fd;
-
- type = zend_hash_get_current_key(Z_ARRVAL_P(stream_array),
- &key, &num_ind, 0);
- if (type == HASH_KEY_NON_EXISTENT ||
- (elem = zend_hash_get_current_data(Z_ARRVAL_P(stream_array))) == NULL) {
- continue; /* should not happen */
- }
-
php_stream_from_zval_no_verify(stream, elem);
if (stream == NULL) {
continue;
@@ -689,9 +668,9 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
php_socket_t this_fd = (php_socket_t)tmp_fd;
if (PHP_SAFE_FD_ISSET(this_fd, fds)) {
- if (type == HASH_KEY_IS_LONG) {
+ if (!key) {
dest_elem = zend_hash_index_update(Z_ARRVAL(new_array), num_ind, elem);
- } else { /* HASH_KEY_IS_STRING */
+ } else {
dest_elem = zend_hash_update(Z_ARRVAL(new_array), key, elem);
}
@@ -702,14 +681,13 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
continue;
}
}
- }
+ } ZEND_HASH_FOREACH_END();
/* destroy old array and add new one */
zend_hash_destroy(Z_ARRVAL_P(stream_array));
GC_REMOVE_FROM_BUFFER(Z_ARR_P(stream_array));
efree(Z_ARR_P(stream_array));
- zend_hash_internal_pointer_reset(Z_ARRVAL(new_array));
Z_ARR_P(stream_array) = Z_ARR(new_array);
return ret;
@@ -727,10 +705,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array TSRMLS_DC)
ZVAL_NEW_ARR(&new_array);
zend_hash_init(Z_ARRVAL(new_array), zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0);
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array));
- (elem = zend_hash_get_current_data(Z_ARRVAL_P(stream_array))) != NULL;
- zend_hash_move_forward(Z_ARRVAL_P(stream_array))) {
-
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(stream_array), elem) {
php_stream_from_zval_no_verify(stream, elem);
if (stream == NULL) {
continue;
@@ -749,14 +724,12 @@ static int stream_array_emulate_read_fd_set(zval *stream_array TSRMLS_DC)
ret++;
continue;
}
- }
+ } ZEND_HASH_FOREACH_END();
if (ret > 0) {
/* destroy old array and add new one */
zend_hash_destroy(Z_ARRVAL_P(stream_array));
efree(Z_ARR_P(stream_array));
-
- zend_hash_internal_pointer_reset(Z_ARRVAL(new_array));
Z_ARR_P(stream_array) = Z_ARR(new_array);
} else {
zend_hash_destroy(Z_ARRVAL(new_array));
@@ -911,31 +884,24 @@ static void user_space_stream_notifier_dtor(php_stream_notifier *notifier)
static int parse_context_options(php_stream_context *context, zval *options TSRMLS_DC)
{
- HashPosition pos, opos;
zval *wval, *oval;
zend_string *wkey, *okey;
int ret = SUCCESS;
ulong num_key;
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(options), &pos);
- while (NULL != (wval = zend_hash_get_current_data_ex(Z_ARRVAL_P(options), &pos))) {
- if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(options), &wkey, &num_key, 0, &pos)
- && Z_TYPE_P(wval) == IS_ARRAY) {
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(wval), &opos);
- while (NULL != (oval = zend_hash_get_current_data_ex(Z_ARRVAL_P(wval), &opos))) {
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(options), num_key, wkey, wval) {
+ if (wkey && Z_TYPE_P(wval) == IS_ARRAY) {
- if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(wval), &okey, &num_key, 0, &opos)) {
+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(wval), num_key, okey, oval) {
+ if (okey) {
php_stream_context_set_option(context, wkey->val, okey->val, oval);
}
- zend_hash_move_forward_ex(Z_ARRVAL_P(wval), &opos);
- }
+ } ZEND_HASH_FOREACH_END();
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "options should have the form [\"wrappername\"][\"optionname\"] = $value");
}
- zend_hash_move_forward_ex(Z_ARRVAL_P(options), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
return ret;
}
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 290fa21879..a1ea1cbf45 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -1121,7 +1121,6 @@ PHP_FUNCTION(explode)
PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC)
{
zval *tmp;
- HashPosition pos;
smart_str implstr = {0};
int numelems, i = 0;
zval tmp_val;
@@ -1133,9 +1132,7 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC)
RETURN_EMPTY_STRING();
}
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos);
-
- while ((tmp = zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), &pos)) != NULL) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(arr), tmp) {
again:
switch (Z_TYPE_P(tmp)) {
case IS_STRING:
@@ -1191,8 +1188,8 @@ again:
if (++i != numelems) {
smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRLEN_P(delim));
}
- zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos);
- }
+ } ZEND_HASH_FOREACH_END();
+
smart_str_0(&implstr);
if (implstr.s) {
@@ -2871,56 +2868,49 @@ static void php_strtr_free_strp(void *strp)
static PATNREPL *php_strtr_array_prepare_repls(int slen, HashTable *pats, zend_llist **allocs, int *outsize)
{
PATNREPL *patterns;
- HashPosition hpos;
zval *entry;
int num_pats = zend_hash_num_elements(pats),
- i;
+ i = 0;
+ zend_string *string_key;
+ ulong num_key;
patterns = safe_emalloc(num_pats, sizeof(*patterns), 0);
*allocs = emalloc(sizeof **allocs);
zend_llist_init(*allocs, sizeof(zend_string*), &php_strtr_free_strp, 0);
- for (i = 0, zend_hash_internal_pointer_reset_ex(pats, &hpos);
- (entry = zend_hash_get_current_data_ex(pats, &hpos)) != NULL;
- zend_hash_move_forward_ex(pats, &hpos)) {
- zend_string *string_key;
- ulong num_key;
+ ZEND_HASH_FOREACH_KEY_VAL(pats, num_key, string_key, entry) {
zval tzv;
- switch (zend_hash_get_current_key_ex(pats, &string_key, &num_key, 0, &hpos)) {
- case HASH_KEY_IS_LONG: {
+ if (!string_key) {
char buf[MAX_LENGTH_OF_LONG];
int len = snprintf(buf, sizeof(buf), "%ld", num_key);
string_key = STR_INIT(buf, len, 0);
zend_llist_add_element(*allocs, &string_key);
- /* break missing intentionally */
- }
- case HASH_KEY_IS_STRING:
- if (string_key->len == 0) { /* empty string given as pattern */
- efree(patterns);
- zend_llist_destroy(*allocs);
- efree(*allocs);
- *allocs = NULL;
- return NULL;
- }
- if (string_key->len > slen) { /* this pattern can never match */
- continue;
- }
-
- if (Z_TYPE_P(entry) != IS_STRING) {
- ZVAL_DUP(&tzv, entry);
- convert_to_string(&tzv);
- entry = &tzv;
- zend_llist_add_element(*allocs, &Z_STR_P(entry));
- }
+ }
+ if (string_key->len == 0) { /* empty string given as pattern */
+ efree(patterns);
+ zend_llist_destroy(*allocs);
+ efree(*allocs);
+ *allocs = NULL;
+ return NULL;
+ }
+ if (string_key->len > slen) { /* this pattern can never match */
+ continue;
+ }
- S(&patterns[i].pat) = string_key->val;
- L(&patterns[i].pat) = string_key->len;
- S(&patterns[i].repl) = Z_STRVAL_P(entry);
- L(&patterns[i].repl) = Z_STRLEN_P(entry);
- i++;
+ if (Z_TYPE_P(entry) != IS_STRING) {
+ ZVAL_DUP(&tzv, entry);
+ convert_to_string(&tzv);
+ entry = &tzv;
+ zend_llist_add_element(*allocs, &Z_STR_P(entry));
}
- }
+
+ S(&patterns[i].pat) = string_key->val;
+ L(&patterns[i].pat) = string_key->len;
+ S(&patterns[i].repl) = Z_STRVAL_P(entry);
+ L(&patterns[i].repl) = Z_STRLEN_P(entry);
+ i++;
+ } ZEND_HASH_FOREACH_END();
*outsize = i;
return patterns;
@@ -3826,8 +3816,6 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec
/* Duplicate subject string for repeated replacement */
ZVAL_DUP(result, subject);
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(search));
-
if (Z_TYPE_P(replace) == IS_ARRAY) {
zend_hash_internal_pointer_reset(Z_ARRVAL_P(replace));
} else {
@@ -3837,12 +3825,11 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec
}
/* For each entry in the search array, get the entry */
- while ((search_entry = zend_hash_get_current_data(Z_ARRVAL_P(search))) != NULL) {
+ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(search), search_entry) {
/* Make sure we're dealing with strings. */
SEPARATE_ZVAL(search_entry);
convert_to_string(search_entry);
if (Z_STRLEN_P(search_entry) == 0) {
- zend_hash_move_forward(Z_ARRVAL_P(search));
if (Z_TYPE_P(replace) == IS_ARRAY) {
zend_hash_move_forward(Z_ARRVAL_P(replace));
}
@@ -3891,9 +3878,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec
zval_ptr_dtor(&tmp_subject);
return;
}
-
- zend_hash_move_forward(Z_ARRVAL_P(search));
- }
+ } ZEND_HASH_FOREACH_END();
} else {
if (Z_STRLEN_P(search) == 1) {
php_char_to_str_ex(Z_STRVAL_P(subject),
@@ -4283,12 +4268,23 @@ PHP_FUNCTION(strip_tags)
/* To maintain a certain BC, we allow anything for the second parameter and return original string */
if (allow != NULL) {
convert_to_string_ex(allow);
- allowed_tags = Z_STRVAL_P(allow);
- allowed_tags_len = Z_STRLEN_P(allow);
+// TODO: reimplement to avoid reallocation ???
+ if (IS_INTERNED(Z_STR_P(allow))) {
+ allowed_tags = estrndup(Z_STRVAL_P(allow), Z_STRLEN_P(allow));
+ allowed_tags_len = Z_STRLEN_P(allow);
+ } else {
+ allowed_tags = Z_STRVAL_P(allow);
+ allowed_tags_len = Z_STRLEN_P(allow);
+ }
}
buf = STR_INIT(str, str_len, 0);
buf->len = php_strip_tags_ex(buf->val, str_len, NULL, allowed_tags, allowed_tags_len, 0);
+
+// TODO: reimplement to avoid reallocation ???
+ if (allow && IS_INTERNED(Z_STR_P(allow))) {
+ efree(allowed_tags);
+ }
RETURN_STR(buf);
}
/* }}} */
diff --git a/ext/standard/type.c b/ext/standard/type.c
index 3feac632d8..c4fdbc87e3 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -387,14 +387,16 @@ PHP_FUNCTION(is_callable)
check_flags |= IS_CALLABLE_CHECK_SYNTAX_ONLY;
}
if (ZEND_NUM_ARGS() > 2) {
- if (callable_name) {
- ZVAL_DEREF(callable_name);
- }
+ ZVAL_DEREF(callable_name);
retval = zend_is_callable_ex(var, NULL, check_flags, &name, NULL, &error TSRMLS_CC);
zval_dtor(callable_name);
//??? is it necessary to be consistent with old PHP ("\0" support)
- name->len = strlen(name->val);
- ZVAL_STR(callable_name, name);
+ if (UNEXPECTED(name->len) != strlen(name->val)) {
+ ZVAL_STRINGL(callable_name, name->val, strlen(name->val));
+ STR_RELEASE(name);
+ } else {
+ ZVAL_STR(callable_name, name);
+ }
} else {
retval = zend_is_callable_ex(var, NULL, check_flags, NULL, NULL, &error TSRMLS_CC);
}
diff --git a/ext/standard/url.c b/ext/standard/url.c
index fc49dc3264..c7149dd9f3 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -694,7 +694,6 @@ PHP_FUNCTION(get_headers)
php_stream_context *context;
php_stream *stream;
zval *prev_val, *hdr = NULL, *h;
- HashPosition pos;
HashTable *hashT;
long format = 0;
@@ -726,10 +725,8 @@ PHP_FUNCTION(get_headers)
hashT = HASH_OF(&stream->wrapperdata);
}
- zend_hash_internal_pointer_reset_ex(hashT, &pos);
- while ((hdr = zend_hash_get_current_data_ex(hashT, &pos)) != NULL) {
- if (!hdr || Z_TYPE_P(hdr) != IS_STRING) {
- zend_hash_move_forward_ex(hashT, &pos);
+ ZEND_HASH_FOREACH_VAL(hashT, hdr) {
+ if (Z_TYPE_P(hdr) != IS_STRING) {
continue;
}
if (!format) {
@@ -759,8 +756,7 @@ no_name_header:
goto no_name_header;
}
}
- zend_hash_move_forward_ex(hashT, &pos);
- }
+ } ZEND_HASH_FOREACH_END();
php_stream_close(stream);
}
diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c
index 44b96e3bdd..762b65387a 100644
--- a/ext/standard/user_filters.c
+++ b/ext/standard/user_filters.c
@@ -248,7 +248,7 @@ php_stream_filter_status_t userfilter_filter(
* keeping a reference to the stream resource here would prevent it
* from being destroyed properly */
ZVAL_STRINGL(&zpropname, "stream", sizeof("stream")-1);
- Z_OBJ_HANDLER_P(obj, unset_property)(obj, &zpropname, 0 TSRMLS_CC);
+ Z_OBJ_HANDLER_P(obj, unset_property)(obj, &zpropname, -1 TSRMLS_CC);
zval_ptr_dtor(&zpropname);
zval_ptr_dtor(&args[3]);
@@ -543,12 +543,11 @@ PHP_FUNCTION(stream_get_filters)
filters_hash = php_get_stream_filters_hash();
if (filters_hash) {
- for(zend_hash_internal_pointer_reset(filters_hash);
- (key_flags = zend_hash_get_current_key(filters_hash, &filter_name, &num_key, 0)) != HASH_KEY_NON_EXISTENT;
- zend_hash_move_forward(filters_hash))
- if (key_flags == HASH_KEY_IS_STRING) {
- add_next_index_str(return_value, STR_COPY(filter_name));
- }
+ ZEND_HASH_FOREACH_VAL(filters_hash, key_flags) {
+ if (key_flags == HASH_KEY_IS_STRING) {
+ add_next_index_str(return_value, STR_COPY(filter_name));
+ }
+ } ZEND_HASH_FOREACH_END();
}
/* It's okay to return an empty array if no filters are registered */
}
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 3f669dbda1..a4e556abdc 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -717,27 +717,18 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt
zend_string *key;
zval *d, *name;
ulong index;
- HashPosition pos;
int i;
zval nval, *nvalp;
- HashTable *propers;
+ HashTable *propers, *ht;
ZVAL_NULL(&nval);
nvalp = &nval;
- zend_hash_internal_pointer_reset_ex(HASH_OF(retval_ptr), &pos);
-
- for (;; zend_hash_move_forward_ex(HASH_OF(retval_ptr), &pos)) {
- i = zend_hash_get_current_key_ex(HASH_OF(retval_ptr), &key, &index, 0, &pos);
-
- if (i == HASH_KEY_NON_EXISTENT) {
- break;
- }
-
+ ht = HASH_OF(retval_ptr);
+ ZEND_HASH_FOREACH_KEY_VAL(ht, index, key, name) {
if (incomplete_class && strcmp(key->val, MAGIC_MEMBER) == 0) {
continue;
}
- name = zend_hash_get_current_data_ex(HASH_OF(retval_ptr), &pos);
if (Z_TYPE_P(name) != IS_STRING) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only containing the names of instance-variables to serialize.");
@@ -802,7 +793,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt
php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC);
}
}
- }
+ } ZEND_HASH_FOREACH_END();
}
smart_str_appendc(buf, '}');
}
@@ -954,32 +945,17 @@ again:
zend_string *key;
zval *data;
ulong index;
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(myht, &pos);
- for (;; zend_hash_move_forward_ex(myht, &pos)) {
- data = zend_hash_get_current_data_ex(myht, &pos);
- if (!data) {
- break;
- } else if (Z_TYPE_P(data) == IS_INDIRECT) {
- data = Z_INDIRECT_P(data);
- if (Z_TYPE_P(data) == IS_UNDEF) {
- continue;
- }
- }
- i = zend_hash_get_current_key_ex(myht, &key, &index, 0, &pos);
+ ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, data) {
+
if (incomplete_class && strcmp(key->val, MAGIC_MEMBER) == 0) {
continue;
}
- switch (i) {
- case HASH_KEY_IS_LONG:
- php_var_serialize_long(buf, index);
- break;
- case HASH_KEY_IS_STRING:
- php_var_serialize_string(buf, key->val, key->len);
- break;
+ if (!key) {
+ php_var_serialize_long(buf, index);
+ } else {
+ php_var_serialize_string(buf, key->val, key->len);
}
/* we should still add element even if it's not OK,
@@ -997,7 +973,7 @@ again:
Z_ARRVAL_P(data)->nApplyCount--;
}
}
- }
+ } ZEND_HASH_FOREACH_END();
}
smart_str_appendc(buf, '}');
return;
diff --git a/sapi/phpdbg/phpdbg_info.c b/sapi/phpdbg/phpdbg_info.c
index 660404883c..f7c7ab0846 100644
--- a/sapi/phpdbg/phpdbg_info.c
+++ b/sapi/phpdbg/phpdbg_info.c
@@ -212,10 +212,10 @@ PHPDBG_INFO(literal) /* {{{ */
}
while (literal < ops->last_literal) {
- if (Z_TYPE(ops->literals[literal].constant) != IS_NULL) {
+ if (Z_TYPE(ops->literals[literal]) != IS_NULL) {
phpdbg_write("|-------- C%u -------> [", literal);
zend_print_zval(
- &ops->literals[literal].constant, 0);
+ &ops->literals[literal], 0);
phpdbg_write("]");
phpdbg_writeln(EMPTY);
}
diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c
index 17c5fbdec5..130f868d67 100644
--- a/sapi/phpdbg/phpdbg_opcode.c
+++ b/sapi/phpdbg/phpdbg_opcode.c
@@ -26,7 +26,7 @@
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
-static inline zend_uint phpdbg_decode_literal(zend_op_array *ops, zend_literal *literal TSRMLS_DC) /* {{{ */
+static inline zend_uint phpdbg_decode_literal(zend_op_array *ops, zval *literal TSRMLS_DC) /* {{{ */
{
int iter = 0;
@@ -64,7 +64,7 @@ static inline char *phpdbg_decode_op(zend_op_array *ops, znode_op *op, zend_uint
} break;
case IS_CONST:
- asprintf(&decode, "C%u", phpdbg_decode_literal(ops, op->literal TSRMLS_CC));
+ asprintf(&decode, "C%u", phpdbg_decode_literal(ops, op->zv TSRMLS_CC));
break;
case IS_UNUSED:
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index f4abb97a90..7aea80afdd 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -1079,10 +1079,10 @@ void phpdbg_clean(zend_bool full TSRMLS_DC) /* {{{ */
}
} /* }}} */
-static inline zend_execute_data *phpdbg_create_execute_data(zend_op_array *op_array, zval *return_value, zend_bool nested TSRMLS_DC) /* {{{ */
+static inline zend_execute_data *phpdbg_create_execute_data(zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC) /* {{{ */
{
#if PHP_VERSION_ID >= 50500
- return zend_create_execute_data_from_op_array(op_array, return_value, nested TSRMLS_CC);
+ return zend_create_execute_data_from_op_array(op_array, return_value, frame_kind TSRMLS_CC);
#else
#undef EX