mirror of
https://github.com/php/php-src.git
synced 2026-03-26 17:22:15 +01:00
Delay IS_ERROR checks
This commit is contained in:
@@ -1950,11 +1950,6 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
|
||||
{
|
||||
if (container_op_type != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
|
||||
do {
|
||||
if (container_op_type == IS_VAR && UNEXPECTED(Z_ISERROR_P(container))) {
|
||||
ZVAL_ERROR(result);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Z_ISREF_P(container)) {
|
||||
container = Z_REFVAL_P(container);
|
||||
if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
|
||||
@@ -1969,7 +1964,9 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
|
||||
zval_ptr_dtor_nogc(container);
|
||||
object_init(container);
|
||||
} else {
|
||||
zend_error(E_WARNING, "Attempt to modify property of non-object");
|
||||
if (container_op_type != IS_VAR || EXPECTED(!Z_ISERROR_P(container))) {
|
||||
zend_error(E_WARNING, "Attempt to modify property of non-object");
|
||||
}
|
||||
ZVAL_ERROR(result);
|
||||
return;
|
||||
}
|
||||
@@ -2005,6 +2002,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
|
||||
zval *ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, cache_slot);
|
||||
if (NULL == ptr) {
|
||||
if (EXPECTED(Z_OBJ_HT_P(container)->read_property)) {
|
||||
use_read_property:
|
||||
ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result);
|
||||
if (ptr != result) {
|
||||
ZVAL_INDIRECT(result, ptr);
|
||||
@@ -2019,12 +2017,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
|
||||
ZVAL_INDIRECT(result, ptr);
|
||||
}
|
||||
} else if (EXPECTED(Z_OBJ_HT_P(container)->read_property)) {
|
||||
zval *ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result);
|
||||
if (ptr != result) {
|
||||
ZVAL_INDIRECT(result, ptr);
|
||||
} else if (UNEXPECTED(Z_ISREF_P(ptr) && Z_REFCOUNT_P(ptr) == 1)) {
|
||||
ZVAL_UNREF(ptr);
|
||||
}
|
||||
goto use_read_property;
|
||||
} else {
|
||||
zend_error(E_WARNING, "This object doesn't support property references");
|
||||
ZVAL_ERROR(result);
|
||||
|
||||
@@ -839,11 +839,10 @@ ZEND_VM_C_LABEL(assign_dim_op_convert_to_array):
|
||||
zend_check_string_offset(dim, BP_VAR_RW);
|
||||
zend_wrong_string_offset();
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
ZEND_VM_C_GOTO(assign_dim_op_convert_to_array);
|
||||
} else {
|
||||
if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
ZEND_VM_C_GOTO(assign_dim_op_convert_to_array);
|
||||
}
|
||||
if (UNEXPECTED(OP1_TYPE != IS_VAR || !Z_ISERROR_P(container))) {
|
||||
if (UNEXPECTED(OP1_TYPE != IS_VAR || EXPECTED(!Z_ISERROR_P(container)))) {
|
||||
zend_error(E_WARNING, "Cannot use a scalar value as an array");
|
||||
}
|
||||
ZEND_VM_C_LABEL(assign_dim_op_ret_null):
|
||||
@@ -2159,13 +2158,6 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, SPEC(
|
||||
|
||||
if (OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
|
||||
do {
|
||||
if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(object))) {
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
FREE_OP_DATA();
|
||||
ZEND_VM_C_GOTO(exit_assign_obj);
|
||||
}
|
||||
if (Z_ISREF_P(object)) {
|
||||
object = Z_REFVAL_P(object);
|
||||
if (EXPECTED(Z_TYPE_P(object) == IS_OBJECT)) {
|
||||
@@ -2192,7 +2184,9 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, SPEC(
|
||||
}
|
||||
Z_DELREF_P(object);
|
||||
} else {
|
||||
zend_error(E_WARNING, "Attempt to assign property of non-object");
|
||||
if (OP1_TYPE != IS_VAR || EXPECTED(!Z_ISERROR_P(object))) {
|
||||
zend_error(E_WARNING, "Attempt to assign property of non-object");
|
||||
}
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
@@ -2373,7 +2367,7 @@ ZEND_VM_C_LABEL(try_assign_dim_array):
|
||||
zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0);
|
||||
ZEND_VM_C_GOTO(try_assign_dim_array);
|
||||
} else {
|
||||
if (OP1_TYPE != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) {
|
||||
if (OP1_TYPE != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
|
||||
zend_error(E_WARNING, "Cannot use a scalar value as an array");
|
||||
}
|
||||
dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user