summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-03-27 13:39:09 +0400
committerDmitry Stogov <dmitry@zend.com>2014-03-27 13:39:09 +0400
commitc6cba554544d9dc676d1cfa99447364c95768664 (patch)
treebce842d1abb17b69c78d918384428002d10ed934
parent54d559d893f07098e56bee4489d514726dc96f7d (diff)
downloadphp-git-c6cba554544d9dc676d1cfa99447364c95768664.tar.gz
Use ZVAL_DEREF() macro
-rw-r--r--Zend/zend.c4
-rw-r--r--Zend/zend.h34
-rw-r--r--Zend/zend_API.c24
-rw-r--r--Zend/zend_builtin_functions.c4
-rw-r--r--Zend/zend_exceptions.c4
-rw-r--r--Zend/zend_execute.c79
-rw-r--r--Zend/zend_execute.h10
-rw-r--r--Zend/zend_execute_API.c6
-rw-r--r--Zend/zend_vm_def.h102
-rw-r--r--Zend/zend_vm_execute.h626
-rw-r--r--Zend/zend_vm_gen.php23
-rw-r--r--ext/ereg/ereg.c4
-rw-r--r--ext/pcre/php_pcre.c8
-rw-r--r--ext/standard/array.c52
-rw-r--r--ext/standard/proc_open.c3
-rw-r--r--ext/standard/string.c9
-rw-r--r--ext/standard/type.c13
-rw-r--r--ext/standard/var_unserializer.c65
-rw-r--r--ext/standard/var_unserializer.re5
19 files changed, 374 insertions, 701 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 8b58d4b8b0..e764abb999 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -410,9 +410,7 @@ ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC) /* {{{ */
ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC) /* {{{ */
{
- if (Z_ISREF_P(expr)) {
- expr = Z_REFVAL_P(expr);
- }
+ ZVAL_DEREF(expr);
switch (Z_TYPE_P(expr)) {
case IS_ARRAY:
ZEND_PUTS_EX("Array\n");
diff --git a/Zend/zend.h b/Zend/zend.h
index aaf12ead40..46bc2ff39c 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -669,15 +669,30 @@ END_EXTERN_C()
zval_copy_ctor(__z1); \
} while (0)
+#define ZVAL_DEREF(z) do { \
+ if (UNEXPECTED(Z_ISREF_P(z))) { \
+ (z) = Z_REFVAL_P(z); \
+ } \
+ } while (0)
+
+//??? this macro should be used to get argument value passed by referebce
+//??? unfortunately it's not always work as expected
+#if 0
+#define ZVAL_DEREF_REF(z) do { \
+ ZEND_ASSERT(Z_ISREF_P(z)); \
+ (z) = Z_REFVAL_P(z); \
+ } while (0)
+#else
+#define ZVAL_DEREF_REF(z) \
+ ZVAL_DEREF(z)
+#endif
+
#define ZVAL_DUP_DEREF(z, v) \
do { \
zval *__z1 = (z); \
zval *__z2 = (v); \
- if (Z_ISREF_P(__z2)) { \
- ZVAL_COPY_VALUE(__z1, Z_REFVAL_P(__z2)); \
- } else { \
- ZVAL_COPY_VALUE(__z1, __z2); \
- } \
+ ZVAL_DEREF(__z2); \
+ ZVAL_COPY_VALUE(__z1, __z2); \
zval_copy_ctor(__z1); \
} while (0)
@@ -691,12 +706,6 @@ END_EXTERN_C()
efree(ref); \
} while (0)
-#define ZVAL_DEREF(z) do { \
- if (Z_ISREF_P((z))) { \
- (z) = Z_REFVAL_P((z)); \
- } \
- } while (0)
-
// TODO: invalud ???
#define INIT_PZVAL_COPY(z, v) \
do { \
@@ -738,9 +747,8 @@ END_EXTERN_C()
if (Z_REFCOUNT_P(__zv) == 1) { \
ZVAL_UNREF(__zv); \
} else { \
- zval *ref = Z_REFVAL_P(__zv); \
Z_DELREF_P(__zv); \
- ZVAL_DUP(__zv, ref); \
+ ZVAL_DUP(__zv, Z_REFVAL_P(__zv)); \
} \
} \
} while (0)
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 8676f80727..d3f48ea8bc 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -227,9 +227,7 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */
ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */
{
- if (Z_ISREF_P(arg)) {
- arg = Z_REFVAL_P(arg);
- }
+ ZVAL_DEREF(arg);
return zend_get_type_by_const(Z_TYPE_P(arg));
}
/* }}} */
@@ -360,9 +358,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
spec_walk++;
}
- if (Z_ISREF_P(arg)) {
- arg = Z_REFVAL_P(arg);
- }
+ ZVAL_DEREF(arg);
switch (c) {
case 'l':
@@ -1115,11 +1111,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS_DC) /* {{{ */
{
-// zval *p = pp;
-
- if (Z_ISREF_P(pp)) {
- pp = Z_REFVAL_P(pp);
- }
+ ZVAL_DEREF(pp);
if (IS_CONSTANT_TYPE(Z_TYPE_P(pp))) {
zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry);
@@ -3226,18 +3218,12 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch
break;
}
- if (UNEXPECTED(Z_ISREF_P(method))) {
- method = Z_REFVAL_P(method);
- }
-
+ ZVAL_DEREF(method);
if (Z_TYPE_P(method) != IS_STRING) {
break;
}
- if (UNEXPECTED(Z_ISREF_P(obj))) {
- obj = Z_REFVAL_P(obj);
- }
-
+ ZVAL_DEREF(obj);
if (Z_TYPE_P(obj) == IS_STRING) {
if (callable_name) {
char *ptr;
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index cb52e6ed79..64be0e4b46 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -585,9 +585,7 @@ ZEND_FUNCTION(each)
return;
}
- if (Z_ISREF_P(array)) {
- array = Z_REFVAL_P(array);
- }
+ ZVAL_DEREF_REF(array);
target_hash = HASH_OF(array);
if (!target_hash) {
zend_error(E_WARNING,"Variable passed to each() is not an array or object");
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index c798a768c4..5ba0ae3bc3 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -375,9 +375,7 @@ static int _build_trace_args(zval *arg TSRMLS_DC, int num_args, va_list args, ze
* but that could cause some E_NOTICE and also damn long lines.
*/
- if (Z_ISREF_P(arg)) {
- arg = Z_REFVAL_P(arg);
- }
+ ZVAL_DEREF(arg);
switch (Z_TYPE_P(arg)) {
case IS_NULL:
TRACE_APPEND_STR("NULL, ");
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 3c97388a75..92f298e39f 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -198,9 +198,7 @@ static zend_always_inline zval *_get_zval_ptr_var_deref(zend_uint var, const zen
ret = Z_INDIRECT_P(ret);
}
should_free->var = ret;
- if (UNEXPECTED(Z_ISREF_P(ret))) {
- ret = Z_REFVAL_P(ret);
- }
+ ZVAL_DEREF(ret);
return ret;
}
@@ -281,9 +279,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref(zend_uint var, int type T
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup(ret, var, type TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(ret))) {
- ret = Z_REFVAL_P(ret);
- }
+ ZVAL_DEREF(ret);
return ret;
}
@@ -304,9 +300,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_R(const zend_execu
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_R(ret, var TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(ret))) {
- ret = Z_REFVAL_P(ret);
- }
+ ZVAL_DEREF(ret);
return ret;
}
@@ -327,9 +321,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_UNSET(const zend_e
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_UNSET(ret, var TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(ret))) {
- ret = Z_REFVAL_P(ret);
- }
+ ZVAL_DEREF(ret);
return ret;
}
@@ -350,9 +342,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_IS(const zend_exec
if (Z_TYPE_P(ret) == IS_UNDEF) {
return _get_zval_cv_lookup_BP_VAR_IS(ret, var TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(ret))) {
- ret = Z_REFVAL_P(ret);
- }
+ ZVAL_DEREF(ret);
return ret;
}
@@ -373,9 +363,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_RW(const zend_exec
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_RW(ret, var TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(ret))) {
- ret = Z_REFVAL_P(ret);
- }
+ ZVAL_DEREF(ret);
return ret;
}
@@ -396,9 +384,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_W(const zend_execu
if (Z_TYPE_P(ret) == IS_UNDEF) {
return _get_zval_cv_lookup_BP_VAR_W(ret, var TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(ret))) {
- ret = Z_REFVAL_P(ret);
- }
+ ZVAL_DEREF(ret);
return ret;
}
@@ -535,9 +521,7 @@ static inline void make_real_object(zval *object_ptr TSRMLS_DC)
{
zval *object = object_ptr;
- if (UNEXPECTED(Z_ISREF_P(object_ptr))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
if (Z_TYPE_P(object) == IS_NULL
|| (Z_TYPE_P(object) == IS_BOOL && Z_LVAL_P(object) == 0)
|| (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)
@@ -612,9 +596,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "none", "" TSRMLS_CC);
}
- if (Z_ISREF_P(arg)) {
- arg = Z_REFVAL_P(arg);
- }
+ ZVAL_DEREF(arg);
if (Z_TYPE_P(arg) == IS_OBJECT) {
need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
@@ -631,9 +613,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "" TSRMLS_CC);
}
- if (Z_ISREF_P(arg)) {
- arg = Z_REFVAL_P(arg);
- }
+ ZVAL_DEREF(arg);
if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "" TSRMLS_CC);
}
@@ -662,9 +642,7 @@ static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *p
zval tmp;
zval *object = object_ptr;
- if (Z_ISREF_P(object)) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
if (Z_TYPE_P(object) != IS_OBJECT) {
if (object == &EG(error_zval)) {
if (retval) {
@@ -709,16 +687,11 @@ static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *p
/* separate our value if necessary */
if (value_type == IS_TMP_VAR) {
- if (UNEXPECTED(Z_ISREF_P(value))) {
- ZVAL_COPY_VALUE(&tmp, Z_REFVAL_P(value));
- } else {
- ZVAL_COPY_VALUE(&tmp, value);
- }
+ ZVAL_DEREF(value);
+ ZVAL_COPY_VALUE(&tmp, value);
value = &tmp;
} else if (value_type == IS_CONST) {
- if (UNEXPECTED(Z_ISREF_P(value))) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
ZVAL_DUP(&tmp, value);
} else if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -799,10 +772,7 @@ static inline int zend_assign_to_string_offset(zval *str_offset, zval *value, in
static inline zval* zend_assign_tmp_to_variable(zval *variable_ptr, zval *value TSRMLS_DC)
{
- if (Z_ISREF_P(variable_ptr)) {
- variable_ptr = Z_REFVAL_P(variable_ptr);
- }
-
+ ZVAL_DEREF(variable_ptr);
if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
@@ -827,10 +797,7 @@ static inline zval* zend_assign_tmp_to_variable(zval *variable_ptr, zval *value
static inline zval* zend_assign_const_to_variable(zval *variable_ptr, zval *value TSRMLS_DC)
{
- if (Z_ISREF_P(variable_ptr)) {
- variable_ptr = Z_REFVAL_P(variable_ptr);
- }
-
+ ZVAL_DEREF(variable_ptr);
if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
@@ -1082,10 +1049,7 @@ static void zend_fetch_dimension_address(zval *result, zval *container_ptr, zval
zval *retval;
zval *container = container_ptr;
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
-
+ ZVAL_DEREF(container);
switch (Z_TYPE_P(container)) {
case IS_ARRAY:
if (type != BP_VAR_UNSET) {
@@ -1245,9 +1209,7 @@ static void zend_fetch_dimension_address_read(zval *result, zval *container, zva
{
zval *retval;
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
+ ZVAL_DEREF(container);
switch (Z_TYPE_P(container)) {
case IS_ARRAY:
@@ -1342,10 +1304,7 @@ static void zend_fetch_property_address(zval *result, zval *container_ptr, zval
{
zval *container = container_ptr;
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
-
+ ZVAL_DEREF(container);
if (Z_TYPE_P(container) != IS_OBJECT) {
if (container == &EG(error_zval)) {
ZVAL_INDIRECT(result, &EG(error_zval));
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index d53984b9ce..fcd3441eb1 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -81,12 +81,12 @@ static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC
ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval));
_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_CC);
} else {
- if (Z_REFCOUNT_P(zval_ptr) == 1 && Z_ISREF_P(zval_ptr)) {
+//??? if (Z_REFCOUNT_P(zval_ptr) == 1 && Z_ISREF_P(zval_ptr)) {
/* convert reference to regular value */
//??? zend_reference *ref = Z_REF_P(zval_ptr);
//??? ZVAL_COPY_VALUE(zval_ptr, &ref->val);
//??? efree_rel(ref);
- }
+//??? }
GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
}
}
@@ -98,13 +98,13 @@ static zend_always_inline void i_zval_ptr_dtor_nogc(zval *zval_ptr ZEND_FILE_LIN
if (!Z_DELREF_P(zval_ptr)) {
ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval));
_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_CC);
- } else {
- if (Z_REFCOUNT_P(zval_ptr) == 1 && Z_ISREF_P(zval_ptr)) {
+//??? } else {
+//??? if (Z_REFCOUNT_P(zval_ptr) == 1 && Z_ISREF_P(zval_ptr)) {
/* convert reference to regular value */
//??? zend_reference *ref = Z_REF_P(zval_ptr);
//??? ZVAL_COPY_VALUE(zval_ptr, &ref->val);
//??? efree_rel(ref);
- }
+//??? }
}
}
}
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index b3dfbf8e06..7e41512ad2 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -457,12 +457,12 @@ ZEND_API void _zval_internal_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC) /* {{{ *
Z_DELREF_P(zval_ptr);
if (Z_REFCOUNT_P(zval_ptr) == 0) {
_zval_internal_dtor_for_ptr(zval_ptr ZEND_FILE_LINE_CC);
- } else if (Z_REFCOUNT_P(zval_ptr) == 1) {
- if (Z_ISREF_P(zval_ptr)) {
+//??? } else if (Z_REFCOUNT_P(zval_ptr) == 1) {
+//??? if (Z_ISREF_P(zval_ptr)) {
//??? zend_reference *ref = Z_REF_P(zval_ptr);
//??? ZVAL_COPY_VALUE(zval_ptr, Z_REFVAL_P(zval_ptr));
//??? efree(ref);
- }
+//??? }
}
}
}
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 9f8335f4af..6025342e21 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -343,9 +343,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -502,10 +500,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -797,7 +792,7 @@ ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY)
ZEND_VM_NEXT_OPCODE();
}
- if (Z_ISREF_P(var_ptr)) {
+ if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
} else {
SEPARATE_ZVAL(var_ptr);
@@ -846,7 +841,7 @@ ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY)
ZEND_VM_NEXT_OPCODE();
}
- if (Z_ISREF_P(var_ptr)) {
+ if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
} else {
SEPARATE_ZVAL(var_ptr);
@@ -895,7 +890,7 @@ ZEND_VM_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY)
retval = EX_VAR(opline->result.var);
- if (Z_ISREF_P(var_ptr)) {
+ if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
ZVAL_DUP(retval, var_ptr);
} else {
@@ -942,7 +937,7 @@ ZEND_VM_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY)
retval = EX_VAR(opline->result.var);
- if (Z_ISREF_P(var_ptr)) {
+ if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
ZVAL_DUP(retval, var_ptr);
} else {
@@ -975,11 +970,7 @@ ZEND_VM_HANDLER(40, ZEND_ECHO, CONST|TMP|VAR|CV, ANY)
zval *z;
SAVE_OPLINE();
- z = GET_OP1_ZVAL_PTR(BP_VAR_R);
-
- if (UNEXPECTED(Z_ISREF_P(z))) {
- z = Z_REFVAL_P(z);
- }
+ z = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
zend_print_variable(z);
@@ -1364,13 +1355,9 @@ ZEND_VM_HELPER(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST|TMP
zval *offset;
SAVE_OPLINE();
- container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R);
+ container = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_R);
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -1686,7 +1673,7 @@ ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_ISREF_P(object_ptr) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
+ if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
object_ptr = Z_REFVAL_P(object_ptr);
}
if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
@@ -2389,9 +2376,7 @@ ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV)
}
if (Z_TYPE_P(var) != IS_STRING) {
- if (Z_ISREF_P(var)) {
- var = Z_REFVAL_P(var);
- }
+ ZVAL_DEREF(var);
if (Z_TYPE_P(var) != IS_STRING) {
zend_make_printable_zval(var, &var_copy, &use_copy);
@@ -2477,12 +2462,15 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R);
+ object = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_R);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -2676,10 +2664,8 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
SAVE_OPLINE();
function_name_ptr = function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
- if (Z_ISREF_P(function_name)) {
- function_name = Z_REFVAL_P(function_name);
- }
+ ZVAL_DEREF(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
if (Z_STRVAL_P(function_name)[0] == '\\') {
lcname = STR_ALLOC(Z_STRLEN_P(function_name) - 1, 0);
@@ -2773,6 +2759,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
ZVAL_UNDEF(&call->object);
} else {
+//???
if (!Z_ISREF(call->object)) {
Z_ADDREF(call->object); /* For $this pointer */
} else {
@@ -3339,8 +3326,6 @@ ZEND_VM_C_LABEL(send_again):
}
if (Z_ISREF_P(arg)) {
-//??? ALLOC_ZVAL(arg);
-//??? MAKE_COPY_ZVAL(arg_ptr, arg);
ZVAL_DUP(arg, Z_REFVAL_P(arg));
} else {
if (Z_REFCOUNTED_P(arg)) Z_ADDREF_P(arg);
@@ -3873,11 +3858,7 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
- expr = GET_OP1_ZVAL_PTR(BP_VAR_R);
-
- if (Z_ISREF_P(expr)) {
- expr = Z_REFVAL_P(expr);
- }
+ expr = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!IS_OP1_TMP_FREE()) {
@@ -4288,10 +4269,18 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) &&
(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
array_ptr = array_ref = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
- if (Z_ISREF_P(array_ref)) {
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- if (Z_TYPE_P(array_ptr) == IS_NULL) {
+ ZVAL_DEREF(array_ptr);
+ if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ if (!Z_ISREF_P(array_ref)) {
+ SEPARATE_ZVAL(array_ptr);
+ array_ref = array_ptr;
+ if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ ZVAL_NEW_REF(array_ptr, array_ptr);
+ array_ref = array_ptr;
+ array_ptr = Z_REFVAL_P(array_ptr);
+ }
+ }
+ if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
@@ -4307,24 +4296,11 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
}
array_ref = array_ptr;
} else {
- if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
- if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL(array_ptr);
- array_ref = array_ptr;
- if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- ZVAL_NEW_REF(array_ptr, array_ptr);
- array_ref = array_ptr;
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- }
- }
if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
}
} else {
array_ptr = array_ref = GET_OP1_ZVAL_PTR(BP_VAR_R);
- if (Z_ISREF_P(array_ref)) {
- array_ptr = Z_REFVAL_P(array_ptr);
- }
+ ZVAL_DEREF(array_ptr);
if (IS_OP1_TMP_FREE()) { /* IS_TMP_VAR */
zval tmp;
@@ -4465,9 +4441,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
zval *key = NULL;
array = array_ref = EX_VAR(opline->op1.var);
- if (Z_ISREF_P(array)) {
- array = Z_REFVAL_P(array);
- }
+ ZVAL_DEREF(array);
if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
key = EX_VAR((opline+1)->result.var);
}
@@ -4607,9 +4581,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -4687,12 +4659,9 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
zval *offset;
SAVE_OPLINE();
- container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_IS);
+ container = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_IS);
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@@ -5120,11 +5089,8 @@ ZEND_VM_HANDLER(138, ZEND_INSTANCEOF, TMP|VAR|CV, ANY)
zend_bool result;
SAVE_OPLINE();
- expr = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ expr = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
- if (Z_ISREF_P(expr)) {
- expr = Z_REFVAL_P(expr);
- }
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC);
} else {
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index d10d671ab5..021b9244ad 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -814,8 +814,6 @@ send_again:
}
if (Z_ISREF_P(arg)) {
-//??? ALLOC_ZVAL(arg);
-//??? MAKE_COPY_ZVAL(arg_ptr, arg);
ZVAL_DUP(arg, Z_REFVAL_P(arg));
} else {
if (Z_REFCOUNTED_P(arg)) Z_ADDREF_P(arg);
@@ -1448,10 +1446,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
SAVE_OPLINE();
function_name_ptr = function_name = opline->op2.zv;
- if (Z_ISREF_P(function_name)) {
- function_name = Z_REFVAL_P(function_name);
- }
+ ZVAL_DEREF(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
if (Z_STRVAL_P(function_name)[0] == '\\') {
lcname = STR_ALLOC(Z_STRLEN_P(function_name) - 1, 0);
@@ -1544,6 +1540,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
ZVAL_UNDEF(&call->object);
} else {
+//???
if (!Z_ISREF(call->object)) {
Z_ADDREF(call->object); /* For $this pointer */
} else {
@@ -1791,10 +1788,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
function_name_ptr = function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_ISREF_P(function_name)) {
- function_name = Z_REFVAL_P(function_name);
- }
+ ZVAL_DEREF(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
if (Z_STRVAL_P(function_name)[0] == '\\') {
lcname = STR_ALLOC(Z_STRLEN_P(function_name) - 1, 0);
@@ -1888,6 +1883,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
ZVAL_UNDEF(&call->object);
} else {
+//???
if (!Z_ISREF(call->object)) {
Z_ADDREF(call->object); /* For $this pointer */
} else {
@@ -1986,10 +1982,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
function_name_ptr = function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_ISREF_P(function_name)) {
- function_name = Z_REFVAL_P(function_name);
- }
+ ZVAL_DEREF(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
if (Z_STRVAL_P(function_name)[0] == '\\') {
lcname = STR_ALLOC(Z_STRLEN_P(function_name) - 1, 0);
@@ -2083,6 +2077,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
ZVAL_UNDEF(&call->object);
} else {
+//???
if (!Z_ISREF(call->object)) {
Z_ADDREF(call->object); /* For $this pointer */
} else {
@@ -2219,10 +2214,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
function_name_ptr = function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (Z_ISREF_P(function_name)) {
- function_name = Z_REFVAL_P(function_name);
- }
+ ZVAL_DEREF(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
if (Z_STRVAL_P(function_name)[0] == '\\') {
lcname = STR_ALLOC(Z_STRLEN_P(function_name) - 1, 0);
@@ -2315,6 +2308,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
ZVAL_UNDEF(&call->object);
} else {
+//???
if (!Z_ISREF(call->object)) {
Z_ADDREF(call->object); /* For $this pointer */
} else {
@@ -2375,10 +2369,6 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
z = opline->op1.zv;
- if (UNEXPECTED(Z_ISREF_P(z))) {
- z = Z_REFVAL_P(z);
- }
-
zend_print_variable(z);
CHECK_EXCEPTION();
@@ -2806,10 +2796,6 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
expr = opline->op1.zv;
-
- if (Z_ISREF_P(expr)) {
- expr = Z_REFVAL_P(expr);
- }
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!0) {
@@ -3005,10 +2991,18 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) &&
(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
array_ptr = array_ref = NULL;
- if (Z_ISREF_P(array_ref)) {
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- if (Z_TYPE_P(array_ptr) == IS_NULL) {
+ ZVAL_DEREF(array_ptr);
+ if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ if (!Z_ISREF_P(array_ref)) {
+ SEPARATE_ZVAL(array_ptr);
+ array_ref = array_ptr;
+ if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ ZVAL_NEW_REF(array_ptr, array_ptr);
+ array_ref = array_ptr;
+ array_ptr = Z_REFVAL_P(array_ptr);
+ }
+ }
+ if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
@@ -3024,24 +3018,11 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
}
array_ref = array_ptr;
} else {
- if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
- if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL(array_ptr);
- array_ref = array_ptr;
- if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- ZVAL_NEW_REF(array_ptr, array_ptr);
- array_ref = array_ptr;
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- }
- }
if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
}
} else {
array_ptr = array_ref = opline->op1.zv;
- if (Z_ISREF_P(array_ref)) {
- array_ptr = Z_REFVAL_P(array_ptr);
- }
+ ZVAL_DEREF(array_ptr);
if (0) { /* IS_TMP_VAR */
zval tmp;
@@ -4170,9 +4151,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -5829,9 +5808,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -6499,9 +6476,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -7462,10 +7437,6 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
z = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (UNEXPECTED(Z_ISREF_P(z))) {
- z = Z_REFVAL_P(z);
- }
-
zend_print_variable(z);
zval_dtor(free_op1.var);
@@ -7881,10 +7852,6 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
expr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- if (Z_ISREF_P(expr)) {
- expr = Z_REFVAL_P(expr);
- }
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!1) {
@@ -8080,10 +8047,18 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) &&
(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
array_ptr = array_ref = NULL;
- if (Z_ISREF_P(array_ref)) {
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- if (Z_TYPE_P(array_ptr) == IS_NULL) {
+ ZVAL_DEREF(array_ptr);
+ if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ if (!Z_ISREF_P(array_ref)) {
+ SEPARATE_ZVAL(array_ptr);
+ array_ref = array_ptr;
+ if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ ZVAL_NEW_REF(array_ptr, array_ptr);
+ array_ref = array_ptr;
+ array_ptr = Z_REFVAL_P(array_ptr);
+ }
+ }
+ if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
@@ -8099,24 +8074,11 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
array_ref = array_ptr;
} else {
- if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
- if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL(array_ptr);
- array_ref = array_ptr;
- if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- ZVAL_NEW_REF(array_ptr, array_ptr);
- array_ref = array_ptr;
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- }
- }
if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
}
} else {
array_ptr = array_ref = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (Z_ISREF_P(array_ref)) {
- array_ptr = Z_REFVAL_P(array_ptr);
- }
+ ZVAL_DEREF(array_ptr);
if (1) { /* IS_TMP_VAR */
zval tmp;
@@ -8401,9 +8363,6 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
SAVE_OPLINE();
expr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (Z_ISREF_P(expr)) {
- expr = Z_REFVAL_P(expr);
- }
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC);
} else {
@@ -8968,11 +8927,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
}
object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -9206,9 +9168,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -9725,9 +9685,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_
}
if (Z_TYPE_P(var) != IS_STRING) {
- if (Z_ISREF_P(var)) {
- var = Z_REFVAL_P(var);
- }
+ ZVAL_DEREF(var);
if (Z_TYPE_P(var) != IS_STRING) {
zend_make_printable_zval(var, &var_copy, &use_copy);
@@ -9774,11 +9732,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
}
object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -10563,9 +10524,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_
}
if (Z_TYPE_P(var) != IS_STRING) {
- if (Z_ISREF_P(var)) {
- var = Z_REFVAL_P(var);
- }
+ ZVAL_DEREF(var);
if (Z_TYPE_P(var) != IS_STRING) {
zend_make_printable_zval(var, &var_copy, &use_copy);
@@ -10612,11 +10571,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
}
object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -10852,9 +10814,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -11411,9 +11371,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -11930,9 +11888,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_A
}
if (Z_TYPE_P(var) != IS_STRING) {
- if (Z_ISREF_P(var)) {
- var = Z_REFVAL_P(var);
- }
+ ZVAL_DEREF(var);
if (Z_TYPE_P(var) != IS_STRING) {
zend_make_printable_zval(var, &var_copy, &use_copy);
@@ -11978,11 +11934,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
}
object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -12322,7 +12281,7 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZEND_VM_NEXT_OPCODE();
}
- if (Z_ISREF_P(var_ptr)) {
+ if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
} else {
SEPARATE_ZVAL(var_ptr);
@@ -12371,7 +12330,7 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZEND_VM_NEXT_OPCODE();
}
- if (Z_ISREF_P(var_ptr)) {
+ if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
} else {
SEPARATE_ZVAL(var_ptr);
@@ -12420,7 +12379,7 @@ static int ZEND_FASTCALL ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
retval = EX_VAR(opline->result.var);
- if (Z_ISREF_P(var_ptr)) {
+ if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
ZVAL_DUP(retval, var_ptr);
} else {
@@ -12467,7 +12426,7 @@ static int ZEND_FASTCALL ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
retval = EX_VAR(opline->result.var);
- if (Z_ISREF_P(var_ptr)) {
+ if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
ZVAL_DUP(retval, var_ptr);
} else {
@@ -12500,11 +12459,7 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zval *z;
SAVE_OPLINE();
- z = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- if (UNEXPECTED(Z_ISREF_P(z))) {
- z = Z_REFVAL_P(z);
- }
+ z = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zend_print_variable(z);
@@ -13041,11 +12996,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
- expr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- if (Z_ISREF_P(expr)) {
- expr = Z_REFVAL_P(expr);
- }
+ expr = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!0) {
@@ -13241,10 +13192,18 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) &&
(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
array_ptr = array_ref = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (Z_ISREF_P(array_ref)) {
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- if (Z_TYPE_P(array_ptr) == IS_NULL) {
+ ZVAL_DEREF(array_ptr);
+ if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ if (!Z_ISREF_P(array_ref)) {
+ SEPARATE_ZVAL(array_ptr);
+ array_ref = array_ptr;
+ if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ ZVAL_NEW_REF(array_ptr, array_ptr);
+ array_ref = array_ptr;
+ array_ptr = Z_REFVAL_P(array_ptr);
+ }
+ }
+ if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
@@ -13260,24 +13219,11 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
array_ref = array_ptr;
} else {
- if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
- if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL(array_ptr);
- array_ref = array_ptr;
- if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- ZVAL_NEW_REF(array_ptr, array_ptr);
- array_ref = array_ptr;
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- }
- }
if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
}
} else {
array_ptr = array_ref = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (Z_ISREF_P(array_ref)) {
- array_ptr = Z_REFVAL_P(array_ptr);
- }
+ ZVAL_DEREF(array_ptr);
if (0) { /* IS_TMP_VAR */
zval tmp;
@@ -13418,9 +13364,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
zval *key = NULL;
array = array_ref = EX_VAR(opline->op1.var);
- if (Z_ISREF_P(array)) {
- array = Z_REFVAL_P(array);
- }
+ ZVAL_DEREF(array);
if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
key = EX_VAR((opline+1)->result.var);
}
@@ -13675,11 +13619,8 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
zend_bool result;
SAVE_OPLINE();
- expr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ expr = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (Z_ISREF_P(expr)) {
- expr = Z_REFVAL_P(expr);
- }
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC);
} else {
@@ -13983,9 +13924,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -14142,10 +14081,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binar
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -14782,13 +14718,9 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CONST(
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = opline->op2.zv;
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -15082,7 +15014,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_ISREF_P(object_ptr) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
+ if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
object_ptr = Z_REFVAL_P(object_ptr);
}
if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
@@ -15220,12 +15152,15 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -15811,9 +15746,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -15891,12 +15824,9 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = opline->op2.zv;
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@@ -16463,9 +16393,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -16622,10 +16550,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -17084,13 +17009,9 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_TMP(ZE
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -17384,7 +17305,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_ISREF_P(object_ptr) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
+ if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
object_ptr = Z_REFVAL_P(object_ptr);
}
if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
@@ -17523,12 +17444,15 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -17954,12 +17878,9 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@@ -18526,9 +18447,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -18685,10 +18604,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -19326,13 +19242,9 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_VAR(ZE
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -19626,7 +19538,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_ISREF_P(object_ptr) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
+ if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
object_ptr = Z_REFVAL_P(object_ptr);
}
if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
@@ -19825,12 +19737,15 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -20325,9 +20240,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -20405,12 +20318,9 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@@ -20702,9 +20612,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -20861,10 +20769,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*bina
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -21238,7 +21143,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HA
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_ISREF_P(object_ptr) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
+ if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
object_ptr = Z_REFVAL_P(object_ptr);
}
if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
@@ -21588,9 +21493,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -22108,9 +22011,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -22267,10 +22168,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_o
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -22728,13 +22626,9 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CV(ZEN
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -23028,7 +22922,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_ISREF_P(object_ptr) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
+ if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
object_ptr = Z_REFVAL_P(object_ptr);
}
if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
@@ -23224,12 +23118,15 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -23653,12 +23550,9 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@@ -24030,9 +23924,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -24188,10 +24080,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*bi
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -24473,10 +24362,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CON
container = _get_obj_zval_ptr_unused(TSRMLS_C);
offset = opline->op2.zv;
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -24813,11 +24698,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O
}
object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -25132,9 +25020,6 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON
container = _get_obj_zval_ptr_unused(TSRMLS_C);
offset = opline->op2.zv;
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@@ -25421,9 +25306,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -25579,10 +25462,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*bina
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -25865,10 +25745,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP
container = _get_obj_zval_ptr_unused(TSRMLS_C);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -26164,9 +26040,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDL
}
if (Z_TYPE_P(var) != IS_STRING) {
- if (Z_ISREF_P(var)) {
- var = Z_REFVAL_P(var);
- }
+ ZVAL_DEREF(var);
if (Z_TYPE_P(var) != IS_STRING) {
zend_make_printable_zval(var, &var_copy, &use_copy);
@@ -26213,11 +26087,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC
}
object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -26440,9 +26317,6 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP
container = _get_obj_zval_ptr_unused(TSRMLS_C);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@@ -26729,9 +26603,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -26887,10 +26759,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*bina
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -27173,10 +27042,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR
container = _get_obj_zval_ptr_unused(TSRMLS_C);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -27472,9 +27337,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDL
}
if (Z_TYPE_P(var) != IS_STRING) {
- if (Z_ISREF_P(var)) {
- var = Z_REFVAL_P(var);
- }
+ ZVAL_DEREF(var);
if (Z_TYPE_P(var) != IS_STRING) {
zend_make_printable_zval(var, &var_copy, &use_copy);
@@ -27521,11 +27384,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC
}
object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -27748,9 +27614,6 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR
container = _get_obj_zval_ptr_unused(TSRMLS_C);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@@ -28038,9 +27901,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -28196,10 +28057,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*b
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -28444,9 +28302,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -28602,10 +28458,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binar
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -28887,10 +28740,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(
container = _get_obj_zval_ptr_unused(TSRMLS_C);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -29186,9 +29035,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLE
}
if (Z_TYPE_P(var) != IS_STRING) {
- if (Z_ISREF_P(var)) {
- var = Z_REFVAL_P(var);
- }
+ ZVAL_DEREF(var);
if (Z_TYPE_P(var) != IS_STRING) {
zend_make_printable_zval(var, &var_copy, &use_copy);
@@ -29234,11 +29081,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO
}
object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -29460,9 +29310,6 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(
container = _get_obj_zval_ptr_unused(TSRMLS_C);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@@ -29780,7 +29627,7 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZEND_VM_NEXT_OPCODE();
}
- if (Z_ISREF_P(var_ptr)) {
+ if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
} else {
SEPARATE_ZVAL(var_ptr);
@@ -29828,7 +29675,7 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZEND_VM_NEXT_OPCODE();
}
- if (Z_ISREF_P(var_ptr)) {
+ if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
} else {
SEPARATE_ZVAL(var_ptr);
@@ -29876,7 +29723,7 @@ static int ZEND_FASTCALL ZEND_POST_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
retval = EX_VAR(opline->result.var);
- if (Z_ISREF_P(var_ptr)) {
+ if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
ZVAL_DUP(retval, var_ptr);
} else {
@@ -29922,7 +29769,7 @@ static int ZEND_FASTCALL ZEND_POST_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
retval = EX_VAR(opline->result.var);
- if (Z_ISREF_P(var_ptr)) {
+ if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
ZVAL_DUP(retval, var_ptr);
} else {
@@ -29954,11 +29801,7 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zval *z;
SAVE_OPLINE();
- z = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
-
- if (UNEXPECTED(Z_ISREF_P(z))) {
- z = Z_REFVAL_P(z);
- }
+ z = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
zend_print_variable(z);
@@ -30467,11 +30310,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
- expr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
-
- if (Z_ISREF_P(expr)) {
- expr = Z_REFVAL_P(expr);
- }
+ expr = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!0) {
@@ -30667,10 +30506,18 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
if ((IS_CV == IS_CV || IS_CV == IS_VAR) &&
(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
array_ptr = array_ref = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (Z_ISREF_P(array_ref)) {
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- if (Z_TYPE_P(array_ptr) == IS_NULL) {
+ ZVAL_DEREF(array_ptr);
+ if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ if (!Z_ISREF_P(array_ref)) {
+ SEPARATE_ZVAL(array_ptr);
+ array_ref = array_ptr;
+ if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ ZVAL_NEW_REF(array_ptr, array_ptr);
+ array_ref = array_ptr;
+ array_ptr = Z_REFVAL_P(array_ptr);
+ }
+ }
+ if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
@@ -30686,24 +30533,11 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
}
array_ref = array_ptr;
} else {
- if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
- if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL(array_ptr);
- array_ref = array_ptr;
- if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- ZVAL_NEW_REF(array_ptr, array_ptr);
- array_ref = array_ptr;
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- }
- }
if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
}
} else {
array_ptr = array_ref = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (Z_ISREF_P(array_ref)) {
- array_ptr = Z_REFVAL_P(array_ptr);
- }
+ ZVAL_DEREF(array_ptr);
if (0) { /* IS_TMP_VAR */
zval tmp;
@@ -30957,11 +30791,8 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_bool result;
SAVE_OPLINE();
- expr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ expr = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (Z_ISREF_P(expr)) {
- expr = Z_REFVAL_P(expr);
- }
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC);
} else {
@@ -31265,9 +31096,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -31423,10 +31252,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -32061,13 +31887,9 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CONST(Z
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
offset = opline->op2.zv;
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -32357,7 +32179,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_ISREF_P(object_ptr) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
+ if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
object_ptr = Z_REFVAL_P(object_ptr);
}
if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
@@ -32495,12 +32317,15 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -32879,9 +32704,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -32959,12 +32782,9 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = opline->op2.zv;
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@@ -33527,9 +33347,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -33685,10 +33503,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_o
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -34145,13 +33960,9 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_TMP(ZEN
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -34441,7 +34252,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_ISREF_P(object_ptr) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
+ if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
object_ptr = Z_REFVAL_P(object_ptr);
}
if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
@@ -34580,12 +34391,15 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -34897,12 +34711,9 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@@ -35465,9 +35276,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -35623,10 +35432,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_o
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -36262,13 +36068,9 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_VAR(ZEN
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -36558,7 +36360,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_ISREF_P(object_ptr) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
+ if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
object_ptr = Z_REFVAL_P(object_ptr);
}
if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
@@ -36756,12 +36558,15 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -37142,9 +36947,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -37222,12 +37025,9 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@@ -37515,9 +37315,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -37673,10 +37471,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binar
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -38048,7 +37843,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAN
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_ISREF_P(object_ptr) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
+ if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
object_ptr = Z_REFVAL_P(object_ptr);
}
if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
@@ -38287,9 +38082,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
(opline->extended_value & ZEND_QUICK_SET)) {
if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
value = EX_VAR_NUM(opline->op1.var);
- if (Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- }
+ ZVAL_DEREF(value);
} else {
isset = 0;
}
@@ -38787,9 +38580,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
make_real_object(object TSRMLS_CC);
}
- if (UNEXPECTED(Z_ISREF_P(object))) {
- object = Z_REFVAL_P(object);
- }
+ ZVAL_DEREF(object);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
@@ -38945,10 +38736,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op
Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
zval_ptr_dtor(objval);
} else {
-//???deref
- if (Z_ISREF_P(var_ptr)) {
- var_ptr = Z_REFVAL_P(var_ptr);
- }
+ ZVAL_DEREF(var_ptr);
binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
@@ -39404,13 +39192,9 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CV(ZEND
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (UNEXPECTED(Z_ISREF_P(container))) {
- container = Z_REFVAL_P(container);
- }
-
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
@@ -39700,7 +39484,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_ISREF_P(object_ptr) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
+ if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
object_ptr = Z_REFVAL_P(object_ptr);
}
if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
@@ -39895,12 +39679,15 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, object);
+/*???
if (Z_ISREF_P(object)) {
ZVAL_COPY_VALUE(&call->object, Z_REFVAL_P(object));
} else {
ZVAL_COPY_VALUE(&call->object, object);
}
+*/
if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
@@ -40210,12 +39997,9 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (Z_ISREF_P(container)) {
- container = Z_REFVAL_P(container);
- }
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php
index 5dd5b94fa2..56a923b6a5 100644
--- a/Zend/zend_vm_gen.php
+++ b/Zend/zend_vm_gen.php
@@ -189,6 +189,24 @@ $op2_get_obj_zval_ptr = array(
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
);
+$op1_get_obj_zval_ptr_deref = array(
+ "ANY" => "get_obj_zval_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
+ "VAR" => "_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
+ "CONST" => "opline->op1.zv",
+ "UNUSED" => "_get_obj_zval_ptr_unused(TSRMLS_C)",
+ "CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op1.var TSRMLS_CC)",
+);
+
+$op2_get_obj_zval_ptr_deref = array(
+ "ANY" => "get_obj_zval_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
+ "VAR" => "_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
+ "CONST" => "opline->op2.zv",
+ "UNUSED" => "_get_obj_zval_ptr_unused(TSRMLS_C)",
+ "CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op2.var TSRMLS_CC)",
+);
+
$op1_get_obj_zval_ptr_ptr = array(
"ANY" => "get_obj_zval_ptr_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
"TMP" => "NULL",
@@ -331,6 +349,7 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
$op1_get_zval_ptr_deref, $op2_get_zval_ptr_deref,
$op1_get_zval_ptr_ptr, $op2_get_zval_ptr_ptr,
$op1_get_obj_zval_ptr, $op2_get_obj_zval_ptr,
+ $op1_get_obj_zval_ptr_deref, $op2_get_obj_zval_ptr_deref,
$op1_get_obj_zval_ptr_ptr, $op2_get_obj_zval_ptr_ptr,
$op1_is_tmp_free, $op2_is_tmp_free, $op1_free, $op2_free,
$op1_free_op, $op2_free_op, $op1_free_op_if_var, $op2_free_op_if_var,
@@ -352,6 +371,8 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
"/GET_OP2_ZVAL_PTR_PTR\(([^)]*)\)/",
"/GET_OP1_OBJ_ZVAL_PTR\(([^)]*)\)/",
"/GET_OP2_OBJ_ZVAL_PTR\(([^)]*)\)/",
+ "/GET_OP1_OBJ_ZVAL_PTR_DEREF\(([^)]*)\)/",
+ "/GET_OP2_OBJ_ZVAL_PTR_DEREF\(([^)]*)\)/",
"/GET_OP1_OBJ_ZVAL_PTR_PTR\(([^)]*)\)/",
"/GET_OP2_OBJ_ZVAL_PTR_PTR\(([^)]*)\)/",
"/IS_OP1_TMP_FREE\(\)/",
@@ -388,6 +409,8 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
$op2_get_zval_ptr_ptr[$op2],
$op1_get_obj_zval_ptr[$op1],
$op2_get_obj_zval_ptr[$op2],
+ $op1_get_obj_zval_ptr_deref[$op1],
+ $op2_get_obj_zval_ptr_deref[$op2],
$op1_get_obj_zval_ptr_ptr[$op1],
$op2_get_obj_zval_ptr_ptr[$op2],
$op1_is_tmp_free[$op1],
diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c
index 45ab9f5739..1547d96790 100644
--- a/ext/ereg/ereg.c
+++ b/ext/ereg/ereg.c
@@ -350,8 +350,8 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
}
match_len = 1;
- if (array && Z_ISREF_P(array)) {
- array = Z_REFVAL_P(array);
+ if (array) {
+ ZVAL_DEREF_REF(array);
}
if (array && err != REG_NOMATCH) {
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index d03198cf6c..9cc7815fa1 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -539,8 +539,8 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ *
RETURN_FALSE;
}
- if (subpats && Z_ISREF_P(subpats)) {
- subpats = Z_REFVAL_P(subpats);
+ if (subpats) {
+ ZVAL_DEREF_REF(subpats);
}
php_pcre_match_impl(pce, subject, subject_len, return_value, subpats,
global, ZEND_NUM_ARGS() >= 4, flags, start_offset TSRMLS_CC);
@@ -1392,9 +1392,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
}
}
if (ZEND_NUM_ARGS() > 4) {
- if (Z_ISREF_P(zcount)) {
- zcount = Z_REFVAL_P(zcount);
- }
+ ZVAL_DEREF_REF(zcount);
zval_dtor(zcount);
ZVAL_LONG(zcount, replace_count);
}
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 50f66f026b..60df41f9cd 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -288,9 +288,7 @@ static int php_count_recursive(zval *array, long mode TSRMLS_DC) /* {{{ */
zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos)
) {
Z_ARRVAL_P(array)->nApplyCount++;
- if (Z_ISREF_P(element)) {
- element = Z_REFVAL_P(element);
- }
+ ZVAL_DEREF(element);
cnt += php_count_recursive(element, COUNT_RECURSIVE TSRMLS_CC);
Z_ARRVAL_P(array)->nApplyCount--;
}
@@ -421,14 +419,8 @@ static int php_array_natural_general_compare(const void *a, const void *b, int f
fval = &f->val;
sval = &s->val;
- if (Z_ISREF_P(fval)) {
- fval = Z_REFVAL_P(fval);
- }
-
- if (Z_ISREF_P(sval)) {
- sval = Z_REFVAL_P(sval);
- }
-
+ ZVAL_DEREF(fval);
+ ZVAL_DEREF(sval);
ZVAL_COPY_VALUE(&first, fval);
ZVAL_COPY_VALUE(&second, sval);
@@ -1462,9 +1454,7 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu
{
zval *value_ptr, data;
- if (Z_ISREF_P(entry)) {
- entry = Z_REFVAL_P(entry);
- }
+ ZVAL_DEREF(entry);
if (Z_TYPE_P(entry) == IS_STRING) {
if ((value_ptr = zend_hash_find_ind(eg_active_symbol_table, Z_STR_P(entry))) != NULL) {
ZVAL_DUP(&data, value_ptr);
@@ -1582,11 +1572,7 @@ PHP_FUNCTION(array_fill_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) {
-
- if (UNEXPECTED(Z_ISREF_P(entry))) {
- entry = Z_REFVAL_P(entry);
- }
-
+ ZVAL_DEREF(entry);
if (Z_TYPE_P(entry) == IS_LONG) {
zval_add_ref(val);
zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), val);
@@ -2280,12 +2266,8 @@ PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS
HashTable *thash;
zval tmp;
- if (Z_ISREF_P(src_zval)) {
- src_zval = Z_REFVAL_P(src_zval);
- }
- if (Z_ISREF_P(dest_zval)) {
- dest_zval = Z_REFVAL_P(dest_zval);
- }
+ 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");
@@ -2369,9 +2351,7 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC
zend_hash_move_forward_ex(src, &pos)) {
src_zval = src_entry;
- if (Z_ISREF_P(src_zval)) {
- src_zval = Z_REFVAL_P(src_zval);
- }
+ 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 ||
@@ -2405,9 +2385,7 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC
}
dest_zval = dest_entry;
- if (Z_ISREF_P(dest_zval)) {
- dest_zval = Z_REFVAL_P(dest_zval);
- }
+ ZVAL_DEREF(dest_zval);
if (Z_ARRVAL_P(dest_zval)->nApplyCount > 1 ||
Z_ARRVAL_P(src_zval)->nApplyCount > 1 ||
(Z_ISREF_P(src_entry) && Z_ISREF_P(dest_entry) && Z_REF_P(src_entry) == Z_REF_P(dest_entry) && (Z_REFCOUNT_P(dest_entry) % 2))) {
@@ -2444,9 +2422,7 @@ static void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETERS, int
for (i = 0; i < argc; i++) {
zval *arg = args + i;
- if (Z_ISREF_P(arg)) {
- arg = Z_REFVAL_P(arg);
- }
+ ZVAL_DEREF(arg);
if (Z_TYPE_P(arg) != IS_ARRAY) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is not an array", i + 1);
RETURN_NULL();
@@ -2464,9 +2440,7 @@ static void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETERS, int
for (i = 0; i < argc; i++) {
zval *arg = args + i;
- if (Z_ISREF_P(arg)) {
- arg = Z_REFVAL_P(arg);
- }
+ ZVAL_DEREF(arg);
if (!replace) {
php_array_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_P(arg), recursive TSRMLS_CC);
} else if (recursive && i > 0) { /* First array will be copied directly instead */
@@ -3966,9 +3940,7 @@ PHP_FUNCTION(array_multisort)
for (i = 0; i < argc; i++) {
zval *arg = &args[i];
- if (Z_ISREF_P(arg)) {
- arg = Z_REFVAL_P(arg);
- }
+ ZVAL_DEREF(arg);
if (Z_TYPE_P(arg) == IS_ARRAY) {
/* We see the next array, so we update the sort flags of
* the previous array and reset the sort flags. */
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 2728cc3a6e..f1f98e7101 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -897,8 +897,7 @@ PHP_FUNCTION(proc_open)
proc->env = env;
if (pipes != NULL) {
- ZEND_ASSERT(Z_ISREF_P(pipes));
- pipes = Z_REFVAL_P(pipes);
+ ZVAL_DEREF_REF(pipes);
zval_dtor(pipes);
}
diff --git a/ext/standard/string.c b/ext/standard/string.c
index e3a1df1f24..5e06a7a74d 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2502,10 +2502,7 @@ PHP_FUNCTION(substr_replace)
zval *repl_str;
zval zrepl;
- if (Z_ISREF_P(tmp_repl)) {
- tmp_repl = Z_REFVAL_P(tmp_repl);
- }
-
+ ZVAL_DEREF(tmp_repl);
if (Z_TYPE_P(tmp_repl) != IS_STRING) {
ZVAL_DUP(&zrepl, tmp_repl);
convert_to_string(&zrepl);
@@ -4428,9 +4425,7 @@ PHP_FUNCTION(parse_str)
array_init(&ret);
sapi_module.treat_data(PARSE_STRING, res, &ret TSRMLS_CC);
/* Clear out the array that was passed in. */
- if (Z_ISREF_P(arrayArg)) {
- arrayArg = Z_REFVAL_P(arrayArg);
- }
+ ZVAL_DEREF(arrayArg);
zval_dtor(arrayArg);
ZVAL_COPY_VALUE(arrayArg, &ret);
}
diff --git a/ext/standard/type.c b/ext/standard/type.c
index e95666e439..6ad6d33ab0 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -98,10 +98,7 @@ PHP_FUNCTION(settype)
return;
}
- if (Z_TYPE_P(var)) {
- var = Z_REFVAL_P(var);
- }
-
+ ZVAL_DEREF_REF(var);
if (!strcasecmp(type, "integer")) {
convert_to_long(var);
} else if (!strcasecmp(type, "int")) {
@@ -224,9 +221,7 @@ static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
RETURN_FALSE;
}
- if (Z_ISREF_P(arg)) {
- arg = Z_REFVAL_P(arg);
- }
+ ZVAL_DEREF(arg);
if (Z_TYPE_P(arg) == type) {
if (type == IS_OBJECT) {
zend_class_entry *ce;
@@ -392,8 +387,8 @@ PHP_FUNCTION(is_callable)
check_flags |= IS_CALLABLE_CHECK_SYNTAX_ONLY;
}
if (ZEND_NUM_ARGS() > 2) {
- if (callable_name && Z_ISREF_P(callable_name)) {
- callable_name = Z_REFVAL_P(callable_name);
+ if (callable_name) {
+ ZVAL_DEREF(callable_name);
}
retval = zend_is_callable_ex(var, NULL, check_flags, &name, NULL, &error TSRMLS_CC);
zval_dtor(callable_name);
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index 13f645b58e..c062c5800d 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -398,10 +398,7 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, long elements)
return 0;
}
- if (Z_ISREF_P(rval)) {
- rval = Z_REFVAL_P(rval);
- }
-
+ ZVAL_DEREF(rval);
if (Z_OBJCE_P(rval) != PHP_IC_ENTRY &&
zend_hash_str_exists(&Z_OBJCE_P(rval)->function_table, "__wakeup", sizeof("__wakeup")-1)) {
ZVAL_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1);
@@ -442,7 +439,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
start = cursor;
-#line 446 "ext/standard/var_unserializer.c"
+#line 443 "ext/standard/var_unserializer.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -502,9 +499,9 @@ yy2:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy95;
yy3:
-#line 792 "ext/standard/var_unserializer.re"
+#line 789 "ext/standard/var_unserializer.re"
{ return 0; }
-#line 508 "ext/standard/var_unserializer.c"
+#line 505 "ext/standard/var_unserializer.c"
yy4:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy89;
@@ -547,13 +544,13 @@ yy13:
goto yy3;
yy14:
++YYCURSOR;
-#line 786 "ext/standard/var_unserializer.re"
+#line 783 "ext/standard/var_unserializer.re"
{
/* this is the case where we have less data than planned */
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data");
return 0; /* not sure if it should be 0 or 1 here? */
}
-#line 557 "ext/standard/var_unserializer.c"
+#line 554 "ext/standard/var_unserializer.c"
yy16:
yych = *++YYCURSOR;
goto yy3;
@@ -583,7 +580,7 @@ yy20:
yych = *++YYCURSOR;
if (yych != '"') goto yy18;
++YYCURSOR;
-#line 647 "ext/standard/var_unserializer.re"
+#line 644 "ext/standard/var_unserializer.re"
{
size_t len, len2, len3, maxlen;
long elements;
@@ -722,7 +719,7 @@ yy20:
return object_common2(UNSERIALIZE_PASSTHRU, elements);
}
-#line 726 "ext/standard/var_unserializer.c"
+#line 723 "ext/standard/var_unserializer.c"
yy25:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -747,7 +744,7 @@ yy27:
yych = *++YYCURSOR;
if (yych != '"') goto yy18;
++YYCURSOR;
-#line 639 "ext/standard/var_unserializer.re"
+#line 636 "ext/standard/var_unserializer.re"
{
//??? INIT_PZVAL(rval);
@@ -755,7 +752,7 @@ yy27:
return object_common2(UNSERIALIZE_PASSTHRU,
object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR));
}
-#line 759 "ext/standard/var_unserializer.c"
+#line 756 "ext/standard/var_unserializer.c"
yy32:
yych = *++YYCURSOR;
if (yych == '+') goto yy33;
@@ -776,7 +773,7 @@ yy34:
yych = *++YYCURSOR;
if (yych != '{') goto yy18;
++YYCURSOR;
-#line 618 "ext/standard/var_unserializer.re"
+#line 615 "ext/standard/var_unserializer.re"
{
long elements = parse_iv(start + 2);
/* use iv() not uiv() in order to check data range */
@@ -797,7 +794,7 @@ yy34:
return finish_nested_data(UNSERIALIZE_PASSTHRU);
}
-#line 801 "ext/standard/var_unserializer.c"
+#line 798 "ext/standard/var_unserializer.c"
yy39:
yych = *++YYCURSOR;
if (yych == '+') goto yy40;
@@ -818,7 +815,7 @@ yy41:
yych = *++YYCURSOR;
if (yych != '"') goto yy18;
++YYCURSOR;
-#line 588 "ext/standard/var_unserializer.re"
+#line 585 "ext/standard/var_unserializer.re"
{
size_t len, maxlen;
//??? TODO: use zend_string* instead of char*
@@ -848,7 +845,7 @@ yy41:
efree(str);
return 1;
}
-#line 852 "ext/standard/var_unserializer.c"
+#line 849 "ext/standard/var_unserializer.c"
yy46:
yych = *++YYCURSOR;
if (yych == '+') goto yy47;
@@ -869,7 +866,7 @@ yy48:
yych = *++YYCURSOR;
if (yych != '"') goto yy18;
++YYCURSOR;
-#line 561 "ext/standard/var_unserializer.re"
+#line 558 "ext/standard/var_unserializer.re"
{
size_t len, maxlen;
char *str;
@@ -896,7 +893,7 @@ yy48:
ZVAL_STRINGL(rval, str, len);
return 1;
}
-#line 900 "ext/standard/var_unserializer.c"
+#line 897 "ext/standard/var_unserializer.c"
yy53:
yych = *++YYCURSOR;
if (yych <= '/') {
@@ -984,7 +981,7 @@ yy61:
}
yy63:
++YYCURSOR;
-#line 552 "ext/standard/var_unserializer.re"
+#line 549 "ext/standard/var_unserializer.re"
{
#if SIZEOF_LONG == 4
use_double:
@@ -993,7 +990,7 @@ use_double:
ZVAL_DOUBLE(rval, zend_strtod((const char *)start + 2, NULL));
return 1;
}
-#line 997 "ext/standard/var_unserializer.c"
+#line 994 "ext/standard/var_unserializer.c"
yy65:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -1052,7 +1049,7 @@ yy73:
yych = *++YYCURSOR;
if (yych != ';') goto yy18;
++YYCURSOR;
-#line 536 "ext/standard/var_unserializer.re"
+#line 533 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
@@ -1068,7 +1065,7 @@ yy73:
return 1;
}
-#line 1072 "ext/standard/var_unserializer.c"
+#line 1069 "ext/standard/var_unserializer.c"
yy76:
yych = *++YYCURSOR;
if (yych == 'N') goto yy73;
@@ -1095,7 +1092,7 @@ yy79:
if (yych <= '9') goto yy79;
if (yych != ';') goto yy18;
++YYCURSOR;
-#line 510 "ext/standard/var_unserializer.re"
+#line 507 "ext/standard/var_unserializer.re"
{
#if SIZEOF_LONG == 4
int digits = YYCURSOR - start - 3;
@@ -1121,7 +1118,7 @@ yy79:
ZVAL_LONG(rval, parse_iv(start + 2));
return 1;
}
-#line 1125 "ext/standard/var_unserializer.c"
+#line 1122 "ext/standard/var_unserializer.c"
yy83:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
@@ -1129,22 +1126,22 @@ yy83:
yych = *++YYCURSOR;
if (yych != ';') goto yy18;
++YYCURSOR;
-#line 504 "ext/standard/var_unserializer.re"
+#line 501 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
ZVAL_BOOL(rval, parse_iv(start + 2));
return 1;
}
-#line 1139 "ext/standard/var_unserializer.c"
+#line 1136 "ext/standard/var_unserializer.c"
yy87:
++YYCURSOR;
-#line 498 "ext/standard/var_unserializer.re"
+#line 495 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
ZVAL_NULL(rval);
return 1;
}
-#line 1148 "ext/standard/var_unserializer.c"
+#line 1145 "ext/standard/var_unserializer.c"
yy89:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -1167,7 +1164,7 @@ yy91:
if (yych <= '9') goto yy91;
if (yych != ';') goto yy18;
++YYCURSOR;
-#line 475 "ext/standard/var_unserializer.re"
+#line 472 "ext/standard/var_unserializer.re"
{
long id;
@@ -1190,7 +1187,7 @@ yy91:
return 1;
}
-#line 1194 "ext/standard/var_unserializer.c"
+#line 1191 "ext/standard/var_unserializer.c"
yy95:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -1213,7 +1210,7 @@ yy97:
if (yych <= '9') goto yy97;
if (yych != ';') goto yy18;
++YYCURSOR;
-#line 450 "ext/standard/var_unserializer.re"
+#line 447 "ext/standard/var_unserializer.re"
{
long id;
@@ -1238,9 +1235,9 @@ yy97:
return 1;
}
-#line 1242 "ext/standard/var_unserializer.c"
+#line 1239 "ext/standard/var_unserializer.c"
}
-#line 794 "ext/standard/var_unserializer.re"
+#line 791 "ext/standard/var_unserializer.re"
return 0;
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index cda2dcd452..ec9bfae398 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -402,10 +402,7 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, long elements)
return 0;
}
- if (Z_ISREF_P(rval)) {
- rval = Z_REFVAL_P(rval);
- }
-
+ ZVAL_DEREF(rval);
if (Z_OBJCE_P(rval) != PHP_IC_ENTRY &&
zend_hash_str_exists(&Z_OBJCE_P(rval)->function_table, "__wakeup", sizeof("__wakeup")-1)) {
ZVAL_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1);