summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/dom/php_dom.c1
-rw-r--r--ext/dom/tests/bug67949.phpt8
-rw-r--r--ext/opcache/Optimizer/zend_dump.c4
-rw-r--r--ext/opcache/Optimizer/zend_inference.c43
-rw-r--r--ext/opcache/Optimizer/zend_inference.h2
-rw-r--r--ext/opcache/jit/zend_jit_helpers.c8
-rw-r--r--ext/opcache/jit/zend_jit_x86.dasc31
7 files changed, 20 insertions, 77 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 34666f1711..6fa3b920cd 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -1450,6 +1450,7 @@ static zval *dom_nodelist_read_dimension(zend_object *object, zval *offset, int
zval offset_copy;
if (!offset) {
+ zend_throw_error(NULL, "Cannot access node list without offset");
return NULL;
}
diff --git a/ext/dom/tests/bug67949.phpt b/ext/dom/tests/bug67949.phpt
index dd27352e6c..304c3a91ee 100644
--- a/ext/dom/tests/bug67949.phpt
+++ b/ext/dom/tests/bug67949.phpt
@@ -42,7 +42,11 @@ var_dump(isset($nodes[$offset]), $nodes[$offset]->textContent);
var_dump($offset);
echo "testing read_dimension with null offset\n";
-var_dump($nodes[][] = 1);
+try {
+ var_dump($nodes[][] = 1);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
echo "testing attribute access\n";
$anchor = $doc->getElementsByTagName('a')[0];
@@ -82,7 +86,7 @@ bool(true)
string(4) "data"
string(4) "test"
testing read_dimension with null offset
-NULL
+Cannot access node list without offset
testing attribute access
string(4) "href"
==DONE==
diff --git a/ext/opcache/Optimizer/zend_dump.c b/ext/opcache/Optimizer/zend_dump.c
index 2e9181c0a5..d10e7f989e 100644
--- a/ext/opcache/Optimizer/zend_dump.c
+++ b/ext/opcache/Optimizer/zend_dump.c
@@ -311,10 +311,6 @@ static void zend_dump_type_info(uint32_t info, zend_class_entry *ce, int is_inst
fprintf(stderr, "resource");
}
}
- if (info & MAY_BE_ERROR) {
- if (first) first = 0; else fprintf(stderr, ", ");
- fprintf(stderr, "error");
- }
//TODO: this is useful only for JIT???
if (info & MAY_BE_IN_REG) {
if (first) first = 0; else fprintf(stderr, ", ");
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index 6f40388917..c16652b8b6 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -2065,16 +2065,10 @@ uint32_t zend_array_element_type(uint32_t t1, int write, int insert)
}
if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
tmp |= MAY_BE_NULL;
- if (t1 & MAY_BE_ERROR) {
- if (write) {
- tmp |= MAY_BE_ERROR;
- }
- }
}
if (t1 & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_RESOURCE)) {
- tmp |= MAY_BE_NULL;
- if (write) {
- tmp |= MAY_BE_ERROR;
+ if (!write) {
+ tmp |= MAY_BE_NULL;
}
}
return tmp;
@@ -2425,8 +2419,8 @@ static int zend_update_type_info(const zend_op_array *op_array,
/* If one of the operands cannot have any type, this means the operand derives from
* unreachable code. Propagate the empty result early, so that that the following
* code may assume that operands have at least one type. */
- if (!(t1 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS|MAY_BE_ERROR))
- || !(t2 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS|MAY_BE_ERROR))) {
+ if (!(t1 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS))
+ || !(t2 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS))) {
tmp = 0;
if (ssa_ops[i].result_def >= 0) {
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
@@ -2717,9 +2711,6 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp |= MAY_BE_LONG;
}
} else {
- if (t1 & MAY_BE_ERROR) {
- tmp |= MAY_BE_NULL;
- }
if (t1 & (MAY_BE_UNDEF | MAY_BE_NULL)) {
if (opline->opcode == ZEND_PRE_INC) {
tmp |= MAY_BE_LONG;
@@ -2752,7 +2743,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if (t1 & (MAY_BE_RC1|MAY_BE_RCN)) {
tmp |= MAY_BE_RC1|MAY_BE_RCN;
}
- tmp |= t1 & ~(MAY_BE_UNDEF|MAY_BE_ERROR|MAY_BE_REF|MAY_BE_RCN);
+ tmp |= t1 & ~(MAY_BE_UNDEF|MAY_BE_REF|MAY_BE_RCN);
if (t1 & MAY_BE_UNDEF) {
tmp |= MAY_BE_NULL;
}
@@ -2779,9 +2770,6 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp |= MAY_BE_LONG;
}
} else {
- if (t1 & MAY_BE_ERROR) {
- tmp |= MAY_BE_NULL;
- }
if (t1 & (MAY_BE_UNDEF | MAY_BE_NULL)) {
if (opline->opcode == ZEND_POST_INC) {
tmp |= MAY_BE_LONG;
@@ -2959,7 +2947,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if (opline->op2_type == IS_VAR && opline->extended_value == ZEND_RETURNS_FUNCTION) {
tmp = (MAY_BE_REF | MAY_BE_RCN | MAY_BE_RC1 | t2) & ~MAY_BE_UNDEF;
} else {
- tmp = (MAY_BE_REF | t2) & ~(MAY_BE_UNDEF|MAY_BE_ERROR|MAY_BE_RC1|MAY_BE_RCN);
+ tmp = (MAY_BE_REF | t2) & ~(MAY_BE_UNDEF|MAY_BE_RC1|MAY_BE_RCN);
}
if (t2 & MAY_BE_UNDEF) {
tmp |= MAY_BE_NULL;
@@ -2987,7 +2975,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if ((opline+1)->op1_type == IS_VAR && (opline->extended_value & ZEND_RETURNS_FUNCTION)) {
tmp = (MAY_BE_REF | MAY_BE_RCN | MAY_BE_RC1 | t2) & ~MAY_BE_UNDEF;
} else {
- tmp = (MAY_BE_REF | t2) & ~(MAY_BE_UNDEF|MAY_BE_ERROR|MAY_BE_RC1|MAY_BE_RCN);
+ tmp = (MAY_BE_REF | t2) & ~(MAY_BE_UNDEF|MAY_BE_RC1|MAY_BE_RCN);
}
if (t2 & MAY_BE_UNDEF) {
tmp |= MAY_BE_NULL;
@@ -3484,18 +3472,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
opline->opcode != ZEND_FETCH_LIST_R ? t1 : ((t1 & ~MAY_BE_STRING) | MAY_BE_NULL),
opline->result_type == IS_VAR,
opline->op2_type == IS_UNUSED);
- if (opline->opcode == ZEND_FETCH_DIM_W ||
- opline->opcode == ZEND_FETCH_DIM_RW ||
- opline->opcode == ZEND_FETCH_DIM_FUNC_ARG ||
- opline->opcode == ZEND_FETCH_LIST_W) {
- if (t1 & (MAY_BE_ERROR|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_RESOURCE|MAY_BE_OBJECT)) {
- tmp |= MAY_BE_ERROR;
- } else if (opline->op2_type == IS_UNUSED) {
- tmp |= MAY_BE_ERROR;
- } else if (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT)) {
- tmp |= MAY_BE_ERROR;
- }
- } else if (opline->opcode == ZEND_FETCH_DIM_IS && (t1 & MAY_BE_STRING)) {
+ if (opline->opcode == ZEND_FETCH_DIM_IS && (t1 & MAY_BE_STRING)) {
tmp |= MAY_BE_NULL;
}
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
@@ -3514,7 +3491,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp = zend_fetch_prop_type(script,
zend_fetch_prop_info(op_array, ssa, opline, i), &ce);
if (opline->result_type != IS_TMP_VAR) {
- tmp |= MAY_BE_REF | MAY_BE_ERROR;
+ tmp |= MAY_BE_REF;
}
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
if (ce) {
@@ -3531,7 +3508,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp = zend_fetch_prop_type(script,
zend_fetch_static_prop_info(script, op_array, ssa, opline), &ce);
if (opline->result_type != IS_TMP_VAR) {
- tmp |= MAY_BE_REF | MAY_BE_ERROR;
+ tmp |= MAY_BE_REF;
}
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
if (ce) {
diff --git a/ext/opcache/Optimizer/zend_inference.h b/ext/opcache/Optimizer/zend_inference.h
index 3024583a24..2e5a44d0be 100644
--- a/ext/opcache/Optimizer/zend_inference.h
+++ b/ext/opcache/Optimizer/zend_inference.h
@@ -199,7 +199,7 @@ static zend_always_inline uint32_t get_ssa_var_info(const zend_ssa *ssa, int ssa
if (ssa->var_info && ssa_var_num >= 0) {
return ssa->var_info[ssa_var_num].type;
} else {
- return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ERROR;
+ return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
}
}
diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c
index 37de98d7f0..c626a14ad8 100644
--- a/ext/opcache/jit/zend_jit_helpers.c
+++ b/ext/opcache/jit/zend_jit_helpers.c
@@ -930,9 +930,7 @@ static void ZEND_FASTCALL zend_jit_assign_dim_helper(zval *object_ptr, zval *dim
zend_assign_to_string_offset(object_ptr, dim, value, result);
}
} else {
-//??? if (OP1_TYPE != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_throw_error(NULL, "Cannot use a scalar value as an array");
-//??? }
+ zend_throw_error(NULL, "Cannot use a scalar value as an array");
if (result) {
ZVAL_UNDEF(result);
}
@@ -977,9 +975,7 @@ static void ZEND_FASTCALL zend_jit_assign_dim_op_helper(zval *container, zval *d
//??? } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
//??? ZEND_VM_C_GOTO(assign_dim_op_convert_to_array);
} else {
-//??? if (UNEXPECTED(OP1_TYPE != IS_VAR || EXPECTED(!Z_ISERROR_P(container)))) {
- zend_throw_error(NULL, "Cannot use a scalar value as an array");
-//??? }
+ zend_throw_error(NULL, "Cannot use a scalar value as an array");
//??? if (retval) {
//??? ZVAL_NULL(retval);
//??? }
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 2ab3424bc6..5bda3f5980 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -7542,37 +7542,6 @@ static int zend_jit_send_ref(dasm_State **Dst, const zend_op *opline, zend_op_ar
| // ret = Z_INDIRECT_P(ret);
| GET_Z_PTR r0, r0
|1:
- if (op1_info & MAY_BE_ERROR) {
- if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
- if (cold) {
- | IF_NOT_Z_TYPE r0, _IS_ERROR, >1
- } else {
- | IF_Z_TYPE r0, _IS_ERROR, >1
- |.cold_code
- |1:
- }
- }
-
- | // ZVAL_NEW_EMPTY_REF(arg);
- | EMALLOC sizeof(zend_reference), op_array, opline
- | SET_ZVAL_PTR arg_addr, r0
- | SET_ZVAL_TYPE_INFO arg_addr, IS_REFERENCE_EX
- | mov dword [r0], 1
- | mov dword [r0 + offsetof(zend_reference, gc.u.type_info)], IS_REFERENCE
- | mov aword [r0 + offsetof(zend_reference, sources.ptr)], 0
- ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, 8);
- | // ZVAL_NULL(Z_REFVAL_P(arg));
- | SET_ZVAL_TYPE_INFO ref_addr, IS_NULL
-
- if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
- | jmp >7
- if (cold) {
- |1:
- } else {
- |.code
- }
- }
- }
} else if (opline->op1_type == IS_CV) {
if (op1_info & MAY_BE_UNDEF) {
if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {