summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2010-07-16 11:44:30 +0000
committerDmitry Stogov <dmitry@php.net>2010-07-16 11:44:30 +0000
commit8aad91d14a0d213b1eb6fc1c3160f05c1faee228 (patch)
tree4a48014ac1f07f34d5c6d879a4ed958e686af927 /Zend
parent7043949c892e8b99a51f3e105f17ae133668b007 (diff)
downloadphp-git-8aad91d14a0d213b1eb6fc1c3160f05c1faee228.tar.gz
Simplified string offset reading
Diffstat (limited to 'Zend')
-rw-r--r--Zend/micro_bench.php18
-rw-r--r--Zend/tests/bug31098.phpt2
-rwxr-xr-xZend/tests/bug39304.phpt2
-rw-r--r--Zend/tests/bug39304_2_4.phpt18
-rw-r--r--Zend/tests/str_offset_001.phpt51
-rw-r--r--Zend/zend_execute.c55
-rw-r--r--Zend/zend_vm_def.h216
-rw-r--r--Zend/zend_vm_execute.h2599
8 files changed, 1307 insertions, 1654 deletions
diff --git a/Zend/micro_bench.php b/Zend/micro_bench.php
index b67bfcda9a..87a1b158c2 100644
--- a/Zend/micro_bench.php
+++ b/Zend/micro_bench.php
@@ -188,6 +188,20 @@ function read_global_var($n) {
}
}
+function read_hash($n) {
+ $hash = array('test' => 0);
+ for ($i = 0; $i < $n; ++$i) {
+ $x = $hash['test'];
+ }
+}
+
+function read_str_offset($n) {
+ $str = "test";
+ for ($i = 0; $i < $n; ++$i) {
+ $x = $str[1];
+ }
+}
+
/*****/
function empty_loop($n) {
@@ -300,4 +314,8 @@ read_auto_global(N);
$t = end_test($t, '$x = $_GET', $overhead);
read_global_var(N);
$t = end_test($t, '$x = $GLOBALS[\'v\']', $overhead);
+read_hash(N);
+$t = end_test($t, '$x = $hash[\'v\']', $overhead);
+read_str_offset(N);
+$t = end_test($t, '$x = $str[0]', $overhead);
total($t0, "Total");
diff --git a/Zend/tests/bug31098.phpt b/Zend/tests/bug31098.phpt
index c8626abef1..3038636bab 100644
--- a/Zend/tests/bug31098.phpt
+++ b/Zend/tests/bug31098.phpt
@@ -23,7 +23,6 @@ echo isset($simpleString[0])?"ok\n":"bug\n";
echo isset($simpleString["0"])?"ok\n":"bug\n";
echo isset($simpleString["16"])?"ok\n":"bug\n";
echo isset($simpleString["17"])?"bug\n":"ok\n";
-echo isset($simpleString["wrong"][0])?"bug\n":"ok\n";
echo $simpleString->wrong === null?"ok\n":"bug\n";
echo $simpleString["wrong"] === "B"?"ok\n":"bug\n";
echo $simpleString["0"] === "B"?"ok\n":"bug\n";
@@ -44,7 +43,6 @@ ok
ok
ok
ok
-ok
Notice: Trying to get property of non-object in %sbug31098.php on line %d
ok
diff --git a/Zend/tests/bug39304.phpt b/Zend/tests/bug39304.phpt
index 0129d21348..03916fd0fa 100755
--- a/Zend/tests/bug39304.phpt
+++ b/Zend/tests/bug39304.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #39304 (Segmentation fault with list unpacking of string offset)
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.4.0', '>=')) die('skip ZendEngine 2.4 needed'); ?>
--FILE--
<?php
$s = "";
diff --git a/Zend/tests/bug39304_2_4.phpt b/Zend/tests/bug39304_2_4.phpt
new file mode 100644
index 0000000000..e4863d6fcb
--- /dev/null
+++ b/Zend/tests/bug39304_2_4.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #39304 (Segmentation fault with list unpacking of string offset)
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.4.0', '<')) die('skip ZendEngine 2.4 needed'); ?>
+--FILE--
+<?php
+ $s = "";
+ list($a, $b) = $s[0];
+ var_dump($a,$b);
+?>
+--EXPECTF--
+Notice: Uninitialized string offset: 0 in %sbug39304_2_4.php on line 3
+
+Notice: Uninitialized string offset: 1 in %sbug39304_2_4.php on line 3
+
+Notice: Uninitialized string offset: 0 in %sbug39304_2_4.php on line 3
+string(0) ""
+string(0) ""
diff --git a/Zend/tests/str_offset_001.phpt b/Zend/tests/str_offset_001.phpt
new file mode 100644
index 0000000000..1ebea6e28f
--- /dev/null
+++ b/Zend/tests/str_offset_001.phpt
@@ -0,0 +1,51 @@
+--TEST--
+string offset 001
+--FILE--
+<?php
+function foo($x) {
+ var_dump($x);
+}
+
+$str = "abc";
+var_dump($str[-1]);
+var_dump($str[0]);
+var_dump($str[1]);
+var_dump($str[2]);
+var_dump($str[3]);
+var_dump($str[1][0]);
+var_dump($str[2][1]);
+
+foo($str[-1]);
+foo($str[0]);
+foo($str[1]);
+foo($str[2]);
+foo($str[3]);
+foo($str[1][0]);
+foo($str[2][1]);
+?>
+--EXPECTF--
+Notice: Uninitialized string offset: -1 in %sstr_offset_001.php on line 7
+string(0) ""
+string(1) "a"
+string(1) "b"
+string(1) "c"
+
+Notice: Uninitialized string offset: 3 in %sstr_offset_001.php on line 11
+string(0) ""
+string(1) "b"
+
+Notice: Uninitialized string offset: 1 in %sstr_offset_001.php on line 13
+string(0) ""
+
+Notice: Uninitialized string offset: -1 in %sstr_offset_001.php on line 15
+string(0) ""
+string(1) "a"
+string(1) "b"
+string(1) "c"
+
+Notice: Uninitialized string offset: 3 in %sstr_offset_001.php on line 19
+string(0) ""
+string(1) "b"
+
+Notice: Uninitialized string offset: 1 in %sstr_offset_001.php on line 21
+string(0) ""
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 20835fc803..d6d6a33ded 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -177,42 +177,12 @@ static zend_always_inline zval *_get_zval_ptr_tmp(zend_uint var, const temp_vari
return should_free->var = &T(var).tmp_var;
}
-static zval *_get_zval_ptr_var_string_offset(zend_uint var, const temp_variable *Ts, zend_free_op *should_free TSRMLS_DC)
-{
- temp_variable *T = &T(var);
- zval *str = T->str_offset.str;
- zval *ptr;
-
- /* string offset */
- ALLOC_ZVAL(ptr);
- T->str_offset.ptr = ptr;
- should_free->var = ptr;
-
- if (T->str_offset.str->type != IS_STRING
- || ((int)T->str_offset.offset < 0)
- || (T->str_offset.str->value.str.len <= (int)T->str_offset.offset)) {
- ptr->value.str.val = STR_EMPTY_ALLOC();
- ptr->value.str.len = 0;
- } else {
- ptr->value.str.val = estrndup(str->value.str.val + T->str_offset.offset, 1);
- ptr->value.str.len = 1;
- }
- PZVAL_UNLOCK_FREE(str);
- Z_SET_REFCOUNT_P(ptr, 1);
- Z_SET_ISREF_P(ptr);
- ptr->type = IS_STRING;
- return ptr;
-}
-
static zend_always_inline zval *_get_zval_ptr_var(zend_uint var, const temp_variable *Ts, zend_free_op *should_free TSRMLS_DC)
{
zval *ptr = T(var).var.ptr;
- if (EXPECTED(ptr != NULL)) {
- PZVAL_UNLOCK(ptr, should_free);
- return ptr;
- } else {
- return _get_zval_ptr_var_string_offset(var, Ts, should_free TSRMLS_CC);
- }
+
+ PZVAL_UNLOCK(ptr, should_free);
+ return ptr;
}
static zend_never_inline zval **_get_zval_cv_lookup(zval ***ptr, zend_uint var, int type TSRMLS_DC)
@@ -1286,14 +1256,23 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval **cont
dim = &tmp;
}
if (result) {
+ zval *ptr;
+
+ ALLOC_ZVAL(ptr);
+ INIT_PZVAL(ptr);
+ Z_TYPE_P(ptr) = IS_STRING;
+
if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) {
zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim));
+ Z_STRVAL_P(ptr) = STR_EMPTY_ALLOC();
+ Z_STRLEN_P(ptr) = 0;
+ } else {
+ Z_STRVAL_P(ptr) = (char*)emalloc(2);
+ Z_STRVAL_P(ptr)[0] = Z_STRVAL_P(container)[Z_LVAL_P(dim)];
+ Z_STRVAL_P(ptr)[1] = 0;
+ Z_STRLEN_P(ptr) = 1;
}
- result->str_offset.str = container;
- PZVAL_LOCK(container);
- result->str_offset.offset = Z_LVAL_P(dim);
- result->var.ptr_ptr = NULL;
- result->var.ptr = NULL;
+ AI_SET_PTR(result, ptr);
}
return;
}
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 6f5e87a88c..d5ac20fc0c 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -1182,9 +1182,6 @@ ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, VAR|CV, CONST|TMP|VAR|CV)
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(!RETURN_VALUE_USED(opline)?NULL:&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
FREE_OP2();
FREE_OP1_VAR_PTR();
@@ -1256,10 +1253,6 @@ ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_IS);
-
- if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_IS TSRMLS_CC);
FREE_OP2();
FREE_OP1_VAR_PTR();
@@ -1289,9 +1282,6 @@ ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
}
FREE_OP2();
@@ -3257,33 +3247,17 @@ ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST)
ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
if (OP1_TYPE==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP2();
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
- FREE_OP1();
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -3358,7 +3332,6 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY)
obj = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE == IS_CONST ||
- (OP1_TYPE == IS_VAR && UNEXPECTED(obj == NULL)) ||
UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
zend_error_noreturn(E_ERROR, "__clone method called on non-object");
}
@@ -4383,129 +4356,126 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|TMP|VAR|CV, int prop_dim)
{
USE_OPLINE
- zend_free_op free_op1;
+ zend_free_op free_op1, free_op2;
zval **container;
zval **value = NULL;
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_IS);
- if (OP1_TYPE != IS_VAR || container) {
- zend_free_op free_op2;
- zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
+ offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- ZEND_VM_C_GOTO(num_index_prop);
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ ZEND_VM_C_GOTO(num_index_prop);
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
ZEND_VM_C_LABEL(num_index_prop):
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (OP2_TYPE == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, ZEND_VM_C_GOTO(num_index_prop));
}
- break;
- case IS_STRING:
- if (OP2_TYPE == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, ZEND_VM_C_GOTO(num_index_prop));
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
- FREE_OP2();
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (IS_OP2_TMP_FREE()) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
- FREE_OP2();
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
-
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ }
+ FREE_OP2();
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (IS_OP2_TMP_FREE()) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
- FREE_OP2();
+ }
+ if (IS_OP2_TMP_FREE()) {
+ zval_ptr_dtor(&offset);
} else {
FREE_OP2();
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ FREE_OP2();
+ } else {
+ FREE_OP2();
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index ad62b6ec4a..620f245380 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -1912,7 +1912,6 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
obj = opline->op1.zv;
if (IS_CONST == IS_CONST ||
- (IS_CONST == IS_VAR && UNEXPECTED(obj == NULL)) ||
UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
zend_error_noreturn(E_ERROR, "__clone method called on non-object");
}
@@ -2961,32 +2960,16 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
SAVE_OPLINE();
if (IS_CONST==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
-
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -3759,33 +3742,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op2;
SAVE_OPLINE();
if (IS_CONST==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op2.var);
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
-
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4440,33 +4407,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op2;
SAVE_OPLINE();
if (IS_CONST==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC) TSRMLS_CC);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
-
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5695,32 +5646,16 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
SAVE_OPLINE();
if (IS_CONST==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC) TSRMLS_CC);
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
-
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -6241,7 +6176,6 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
obj = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
if (IS_TMP_VAR == IS_CONST ||
- (IS_TMP_VAR == IS_VAR && UNEXPECTED(obj == NULL)) ||
UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
zend_error_noreturn(E_ERROR, "__clone method called on non-object");
}
@@ -7334,32 +7268,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op1;
SAVE_OPLINE();
if (IS_TMP_VAR==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
_get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
- zval_dtor(free_op1.var);
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -8003,33 +7921,17 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
if (IS_TMP_VAR==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
_get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op2.var);
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
- zval_dtor(free_op1.var);
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -8686,33 +8588,17 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
if (IS_TMP_VAR==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
_get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC) TSRMLS_CC);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
- zval_dtor(free_op1.var);
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -9751,32 +9637,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op1;
SAVE_OPLINE();
if (IS_TMP_VAR==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
_get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC) TSRMLS_CC);
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
- zval_dtor(free_op1.var);
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10581,7 +10451,6 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
obj = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
if (IS_VAR == IS_CONST ||
- (IS_VAR == IS_VAR && UNEXPECTED(obj == NULL)) ||
UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
zend_error_noreturn(E_ERROR, "__clone method called on non-object");
}
@@ -12132,9 +12001,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(!RETURN_VALUE_USED(opline)?NULL:&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -12206,10 +12072,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_IS TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -12239,9 +12101,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OP
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
}
@@ -12905,32 +12764,16 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op1;
SAVE_OPLINE();
if (IS_VAR==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
_get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
- if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -13412,123 +13255,120 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR != IS_VAR || container) {
-
- zval *offset = opline->op2.zv;
+ offset = opline->op2.zv;
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_prop;
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (IS_CONST == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
}
- break;
- case IS_STRING:
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
-
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (0) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (0) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
-
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
+ }
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (0) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
-
+ }
+ if (0) {
+ zval_ptr_dtor(&offset);
} else {
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+
+ } else {
+
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
@@ -14311,9 +14151,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(!RETURN_VALUE_USED(opline)?NULL:&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
zval_dtor(free_op2.var);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -14385,10 +14222,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_IS TSRMLS_CC);
zval_dtor(free_op2.var);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -14418,9 +14251,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCO
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
}
zval_dtor(free_op2.var);
@@ -15086,33 +14916,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
if (IS_VAR==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
_get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op2.var);
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
- if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -15354,129 +15168,126 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE
static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
+ zend_free_op free_op1, free_op2;
zval **container;
zval **value = NULL;
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR != IS_VAR || container) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+ offset = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_prop;
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (IS_TMP_VAR == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
}
- break;
- case IS_STRING:
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
- zval_dtor(free_op2.var);
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (1) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (1) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
- zval_dtor(free_op2.var);
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
-
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ }
+ zval_dtor(free_op2.var);
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (1) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
- zval_dtor(free_op2.var);
+ }
+ if (1) {
+ zval_ptr_dtor(&offset);
} else {
zval_dtor(free_op2.var);
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ zval_dtor(free_op2.var);
+ } else {
+ zval_dtor(free_op2.var);
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
@@ -16415,9 +16226,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(!RETURN_VALUE_USED(opline)?NULL:&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -16489,10 +16297,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_IS TSRMLS_CC);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -16522,9 +16326,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCO
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
}
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
@@ -17245,33 +17046,17 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
if (IS_VAR==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
_get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC) TSRMLS_CC);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
- if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17656,129 +17441,126 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
+ zend_free_op free_op1, free_op2;
zval **container;
zval **value = NULL;
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR != IS_VAR || container) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+ offset = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_prop;
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (IS_VAR == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
}
- break;
- case IS_STRING:
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (0) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (0) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
-
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ }
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (0) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ }
+ if (0) {
+ zval_ptr_dtor(&offset);
} else {
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else {
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
@@ -18294,9 +18076,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UNUSED_HANDLER(ZEND_O
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_R TSRMLS_CC);
}
@@ -19493,9 +19272,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(!RETURN_VALUE_USED(opline)?NULL:&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -19567,10 +19343,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_IS TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -19600,9 +19372,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCOD
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
}
@@ -20319,32 +20088,16 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op1;
SAVE_OPLINE();
if (IS_VAR==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
_get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC) TSRMLS_CC);
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
- if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -20592,123 +20345,120 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
- if (IS_VAR != IS_VAR || container) {
-
- zval *offset = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC);
+ offset = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC);
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_prop;
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (IS_CV == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
}
- break;
- case IS_STRING:
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
-
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (0) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (0) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
-
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
+ }
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (0) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
-
+ }
+ if (0) {
+ zval_ptr_dtor(&offset);
} else {
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+
+ } else {
+
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
@@ -20747,7 +20497,6 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG
obj = _get_obj_zval_ptr_unused(TSRMLS_C);
if (IS_UNUSED == IS_CONST ||
- (IS_UNUSED == IS_VAR && UNEXPECTED(obj == NULL)) ||
UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
zend_error_noreturn(E_ERROR, "__clone method called on non-object");
}
@@ -21938,123 +21687,120 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- if (IS_UNUSED != IS_VAR || container) {
-
- zval *offset = opline->op2.zv;
+ offset = opline->op2.zv;
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_prop;
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (IS_CONST == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
}
- break;
- case IS_STRING:
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
-
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (0) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (0) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
-
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
+ }
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (0) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
-
+ }
+ if (0) {
+ zval_ptr_dtor(&offset);
} else {
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+
+ } else {
+
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
@@ -23100,129 +22846,126 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN
static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
+ zend_free_op free_op2;
zval **container;
zval **value = NULL;
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- if (IS_UNUSED != IS_VAR || container) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+ offset = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_prop;
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (IS_TMP_VAR == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
}
- break;
- case IS_STRING:
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
- zval_dtor(free_op2.var);
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (1) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (1) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
- zval_dtor(free_op2.var);
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
-
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ }
+ zval_dtor(free_op2.var);
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (1) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
- zval_dtor(free_op2.var);
+ }
+ if (1) {
+ zval_ptr_dtor(&offset);
} else {
zval_dtor(free_op2.var);
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ zval_dtor(free_op2.var);
+ } else {
+ zval_dtor(free_op2.var);
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
@@ -24268,129 +24011,126 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN
static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
+ zend_free_op free_op2;
zval **container;
zval **value = NULL;
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- if (IS_UNUSED != IS_VAR || container) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+ offset = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_prop;
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (IS_VAR == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
}
- break;
- case IS_STRING:
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (0) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (0) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
-
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ }
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (0) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ }
+ if (0) {
+ zval_ptr_dtor(&offset);
} else {
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else {
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
@@ -25708,123 +25448,120 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- if (IS_UNUSED != IS_VAR || container) {
-
- zval *offset = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC);
+ offset = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC);
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_prop;
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (IS_CV == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
}
- break;
- case IS_STRING:
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
-
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (0) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (0) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
-
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
+ }
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (0) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
-
+ }
+ if (0) {
+ zval_ptr_dtor(&offset);
} else {
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+
+ } else {
+
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
@@ -26532,7 +26269,6 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
obj = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
if (IS_CV == IS_CONST ||
- (IS_CV == IS_VAR && UNEXPECTED(obj == NULL)) ||
UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
zend_error_noreturn(E_ERROR, "__clone method called on non-object");
}
@@ -27935,9 +27671,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(!RETURN_VALUE_USED(opline)?NULL:&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
@@ -28008,10 +27741,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
-
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_IS TSRMLS_CC);
@@ -28041,9 +27770,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPC
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
}
@@ -28587,32 +28313,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
SAVE_OPLINE();
if (IS_CV==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
_get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
-
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -29001,123 +28711,120 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV != IS_VAR || container) {
-
- zval *offset = opline->op2.zv;
+ offset = opline->op2.zv;
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_prop;
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (IS_CONST == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
}
- break;
- case IS_STRING:
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
-
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (0) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (0) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
-
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
+ }
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (0) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
-
+ }
+ if (0) {
+ zval_ptr_dtor(&offset);
} else {
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+
+ } else {
+
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
@@ -29897,9 +29604,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(!RETURN_VALUE_USED(opline)?NULL:&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
zval_dtor(free_op2.var);
@@ -29970,10 +29674,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
-
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_IS TSRMLS_CC);
zval_dtor(free_op2.var);
@@ -30003,9 +29703,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCOD
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
}
zval_dtor(free_op2.var);
@@ -30551,33 +30248,17 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op2;
SAVE_OPLINE();
if (IS_CV==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
_get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op2.var);
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
-
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -30817,129 +30498,126 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER
static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
+ zend_free_op free_op2;
zval **container;
zval **value = NULL;
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV != IS_VAR || container) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+ offset = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_prop;
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (IS_TMP_VAR == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
}
- break;
- case IS_STRING:
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
- zval_dtor(free_op2.var);
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (1) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (1) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
- zval_dtor(free_op2.var);
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
-
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ }
+ zval_dtor(free_op2.var);
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (1) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
- zval_dtor(free_op2.var);
+ }
+ if (1) {
+ zval_ptr_dtor(&offset);
} else {
zval_dtor(free_op2.var);
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ zval_dtor(free_op2.var);
+ } else {
+ zval_dtor(free_op2.var);
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
@@ -31875,9 +31553,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(!RETURN_VALUE_USED(opline)?NULL:&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
@@ -31948,10 +31623,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
-
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_IS TSRMLS_CC);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
@@ -31981,9 +31652,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCOD
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
}
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
@@ -32583,33 +32251,17 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
zend_free_op free_op2;
SAVE_OPLINE();
if (IS_CV==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
_get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC) TSRMLS_CC);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
-
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -32992,129 +32644,126 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
+ zend_free_op free_op2;
zval **container;
zval **value = NULL;
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV != IS_VAR || container) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
+ offset = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC);
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_prop;
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (IS_VAR == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
}
- break;
- case IS_STRING:
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (0) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (0) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
-
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ }
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (0) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
- if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ }
+ if (0) {
+ zval_ptr_dtor(&offset);
} else {
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
+ } else {
+ if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
@@ -33626,9 +33275,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNUSED_HANDLER(ZEND_OP
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_R TSRMLS_CC);
}
@@ -34711,9 +34357,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(!RETURN_VALUE_USED(opline)?NULL:&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
@@ -34784,10 +34427,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
-
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_IS TSRMLS_CC);
@@ -34817,9 +34456,6 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- }
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
}
@@ -35415,32 +35051,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- int switch_expr_is_overloaded=0;
SAVE_OPLINE();
if (IS_CV==IS_VAR) {
- if (EX_T(opline->op1.var).var.ptr_ptr) {
- PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
- } else {
- switch_expr_is_overloaded = 1;
- Z_ADDREF_P(EX_T(opline->op1.var).str_offset.str);
- }
+ PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
}
is_equal_function(&EX_T(opline->result.var).tmp_var,
_get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC) TSRMLS_CC);
- if (switch_expr_is_overloaded) {
- /* We only free op1 if this is a string offset,
- * Since if it is a TMP_VAR, it'll be reused by
- * other CASE opcodes (whereas string offsets
- * are allocated at each get_zval_ptr())
- */
-
- EX_T(opline->op1.var).var.ptr_ptr = NULL;
- EX_T(opline->op1.var).var.ptr = NULL;
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35686,123 +35306,120 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int
int result = 0;
ulong hval;
long index;
+ zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(EX_CVs(), opline->op1.var TSRMLS_CC);
- if (IS_CV != IS_VAR || container) {
-
- zval *offset = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC);
+ offset = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC);
- if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
- HashTable *ht;
- int isset = 0;
+ if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
+ HashTable *ht;
+ int isset = 0;
- ht = Z_ARRVAL_PP(container);
+ ht = Z_ARRVAL_PP(container);
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- index = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_prop;
- case IS_RESOURCE:
- case IS_BOOL:
- case IS_LONG:
- index = Z_LVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ index = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
- isset = 1;
+ if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
+ isset = 1;
+ }
+ break;
+ case IS_STRING:
+ if (IS_CV == IS_CONST) {
+ hval = Z_HASH_P(offset);
+ } else {
+ if (!prop_dim) {
+ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
}
- break;
- case IS_STRING:
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
+ if (IS_INTERNED(Z_STRVAL_P(offset))) {
+ hval = INTERNED_HASH(Z_STRVAL_P(offset));
} else {
- if (!prop_dim) {
- ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, goto num_index_prop);
- }
- if (IS_INTERNED(Z_STRVAL_P(offset))) {
- hval = INTERNED_HASH(Z_STRVAL_P(offset));
- } else {
- hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
- }
- }
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
- isset = 1;
- }
- break;
- case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
- isset = 1;
+ hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
-
- break;
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
- result = 0;
- } else {
- result = isset;
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value)) {
- result = 0;
- } else {
- result = 1;
+ if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ isset = 1;
}
- }
-
- } else if (Z_TYPE_PP(container) == IS_OBJECT) {
- if (0) {
- MAKE_REAL_ZVAL_PTR(offset);
- }
- if (prop_dim) {
- if (Z_OBJ_HT_P(*container)->has_property) {
- result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check property of non-object");
- result = 0;
+ break;
+ case IS_NULL:
+ if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ isset = 1;
}
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ break;
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ result = 0;
} else {
- if (Z_OBJ_HT_P(*container)->has_dimension) {
- result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
- } else {
- zend_error(E_NOTICE, "Trying to check element of non-array");
- result = 0;
- }
+ result = isset;
}
- if (0) {
- zval_ptr_dtor(&offset);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (!isset || !i_zend_is_true(*value)) {
+ result = 0;
} else {
-
+ result = 1;
}
- } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
- zval tmp;
+ }
- if (Z_TYPE_P(offset) != IS_LONG) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- offset = &tmp;
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (0) {
+ MAKE_REAL_ZVAL_PTR(offset);
+ }
+ if (prop_dim) {
+ if (Z_OBJ_HT_P(*container)->has_property) {
+ result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
}
- if (Z_TYPE_P(offset) == IS_LONG) {
- if (opline->extended_value & ZEND_ISSET) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
- result = 1;
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
- result = 1;
- }
- }
+ } else {
+ if (Z_OBJ_HT_P(*container)->has_dimension) {
+ result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
-
+ }
+ if (0) {
+ zval_ptr_dtor(&offset);
} else {
}
+ } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
+ zval tmp;
+
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ ZVAL_COPY_VALUE(&tmp, offset);
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ if (Z_TYPE_P(offset) == IS_LONG) {
+ if (opline->extended_value & ZEND_ISSET) {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
+ result = 1;
+ }
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+
+ } else {
+
}
Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;