mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Improve error messages for invalid property access
Closes GH-5446 Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
This commit is contained in:
parent
b1fddec717
commit
1179686f62
32 changed files with 101 additions and 100 deletions
|
@ -41,17 +41,17 @@ NULL
|
|||
Warning: Undefined variable $b in %s on line %d
|
||||
int(1)
|
||||
|
||||
Warning: Trying to get property '1' of non-object in %s on line %d
|
||||
Warning: Attempt to read property '1' on int in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Trying to get property '1' of non-object in %s on line %d
|
||||
Warning: Attempt to read property '1' on int in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Undefined variable $c in %s on line %d
|
||||
|
||||
Warning: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Warning: Trying to get property '1' of non-object in %s on line %d
|
||||
Warning: Attempt to read property '1' on int in %s on line %d
|
||||
|
||||
Warning: Trying to get property '' of non-object in %s on line %d
|
||||
Warning: Attempt to read property '' on null in %s on line %d
|
||||
NULL
|
||||
|
|
|
@ -22,7 +22,7 @@ print "ok\n";
|
|||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Trying to get property 'a' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'a' on null in %s on line %d
|
||||
ok
|
||||
Attempt to assign property 'a' of non-object
|
||||
Attempt to assign property 'a' on null
|
||||
ok
|
||||
|
|
|
@ -61,6 +61,6 @@ Warning: Trying to access array offset on value of type null in %s on line %d
|
|||
|
||||
Warning: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Warning: Trying to get property 'foo' of non-object in %s on line %d
|
||||
Attempt to assign property 'foo' of non-object
|
||||
Attempt to assign property 'bar' of non-object
|
||||
Warning: Attempt to read property 'foo' on null in %s on line %d
|
||||
Attempt to assign property 'foo' on null
|
||||
Attempt to assign property 'bar' on null
|
||||
|
|
|
@ -79,5 +79,5 @@ Cannot add element to the array as the next element is already occupied
|
|||
Illegal offset type
|
||||
Illegal offset type
|
||||
Cannot use a scalar value as an array
|
||||
Attempt to assign property 'foo' of non-object
|
||||
Attempt to assign property 'foo' of non-object
|
||||
Attempt to assign property 'foo' on bool
|
||||
Attempt to assign property 'foo' on bool
|
||||
|
|
|
@ -44,7 +44,7 @@ ok
|
|||
ok
|
||||
ok
|
||||
|
||||
Warning: Trying to get property 'wrong' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'wrong' on string in %s on line %d
|
||||
ok
|
||||
|
||||
Warning: Illegal string offset 'wrong' in %s on line %d
|
||||
|
|
|
@ -48,22 +48,22 @@ var_dump($a);
|
|||
?>
|
||||
--EXPECTF--
|
||||
--> read access:
|
||||
Warning: Trying to get property 'p' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'p' on bool in %s on line %d
|
||||
|
||||
--> direct assignment:
|
||||
Attempt to assign property 'p' of non-object
|
||||
Attempt to assign property 'p' on bool
|
||||
|
||||
--> increment:
|
||||
Attempt to increment/decrement property 'p' of non-object
|
||||
Attempt to increment/decrement property 'p' on bool
|
||||
|
||||
--> reference assignment:
|
||||
Attempt to modify property 'p' of non-object
|
||||
Attempt to modify property 'p' on bool
|
||||
|
||||
--> reference assignment:
|
||||
Attempt to modify property 'p' of non-object
|
||||
Attempt to modify property 'p' on bool
|
||||
|
||||
--> indexed assignment:
|
||||
Attempt to modify property 'p' of non-object
|
||||
Attempt to modify property 'p' on bool
|
||||
|
||||
--> Confirm assignments have had no impact:
|
||||
bool(true)
|
||||
|
|
|
@ -7,4 +7,4 @@ $a->{"a"."b"};
|
|||
--EXPECTF--
|
||||
Warning: Undefined variable $a in %s on line %d
|
||||
|
||||
Warning: Trying to get property 'ab' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'ab' on null in %s on line %d
|
||||
|
|
|
@ -48,22 +48,22 @@ var_dump(foo());
|
|||
?>
|
||||
--EXPECTF--
|
||||
Warning: Undefined variable $x in %s on line %d
|
||||
Attempt to assign property 'a' of non-object
|
||||
Attempt to assign property 'a' on null
|
||||
|
||||
Warning: Undefined variable $x in %s on line %d
|
||||
Attempt to modify property 'a' of non-object
|
||||
Attempt to modify property 'a' on null
|
||||
|
||||
Warning: Undefined variable $x in %s on line %d
|
||||
Attempt to increment/decrement property 'a' of non-object
|
||||
Attempt to increment/decrement property 'a' on null
|
||||
|
||||
Warning: Undefined variable $x in %s on line %d
|
||||
Attempt to modify property 'a' of non-object
|
||||
Attempt to modify property 'a' on null
|
||||
|
||||
Warning: Undefined variable $x in %s on line %d
|
||||
Attempt to assign property 'a' of non-object
|
||||
Attempt to assign property 'a' on null
|
||||
|
||||
Warning: Undefined variable $x in %s on line %d
|
||||
Attempt to modify property 'a' of non-object
|
||||
Attempt to modify property 'a' on null
|
||||
|
||||
Warning: Undefined variable $x in %s on line %d
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ array(0) {
|
|||
}
|
||||
array(0) {
|
||||
}
|
||||
Attempt to assign property 'a' of non-object
|
||||
Attempt to assign property 'a' on null
|
||||
NULL
|
||||
object(stdClass)#3 (1) {
|
||||
["a"]=>
|
||||
|
|
|
@ -7,7 +7,7 @@ $d->d = &$d + $d->d/=0;
|
|||
var_dump($d);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Attempt to modify property 'd' of non-object in %s:%d
|
||||
Fatal error: Uncaught Error: Attempt to modify property 'd' on null in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -45,23 +45,23 @@ unset($null);
|
|||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Attempt to assign property 'a' of non-object
|
||||
Attempt to assign property 'a' on null
|
||||
|
||||
Warning: Undefined variable $null in %s on line %d
|
||||
NULL
|
||||
Attempt to modify property 'a' of non-object
|
||||
Attempt to modify property 'a' on null
|
||||
|
||||
Warning: Undefined variable $null in %s on line %d
|
||||
NULL
|
||||
Attempt to modify property 'a' of non-object
|
||||
Attempt to modify property 'a' on null
|
||||
|
||||
Warning: Undefined variable $null in %s on line %d
|
||||
NULL
|
||||
Attempt to modify property 'a' of non-object
|
||||
Attempt to modify property 'a' on null
|
||||
|
||||
Warning: Undefined variable $null in %s on line %d
|
||||
NULL
|
||||
Attempt to modify property 'a' of non-object
|
||||
Attempt to modify property 'a' on null
|
||||
|
||||
Warning: Undefined variable $null in %s on line %d
|
||||
NULL
|
||||
|
|
|
@ -13,7 +13,7 @@ class T {
|
|||
{
|
||||
return $this->$v /= 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$x = new T;
|
||||
$x->x = 1;
|
||||
|
@ -21,18 +21,18 @@ $x->x = 1;
|
|||
--EXPECTF--
|
||||
Warning: Undefined variable $undefined in %s on line %d
|
||||
|
||||
Warning: Trying to get property '1' of non-object in %s on line %d
|
||||
Warning: Attempt to read property '1' on null in %s on line %d
|
||||
|
||||
Warning: Division by zero in %sbug76667.php on line %d
|
||||
Warning: Division by zero in %s on line %d
|
||||
|
||||
Warning: Undefined variable $undefined in %s on line %d
|
||||
|
||||
Warning: Trying to get property 'NAN' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'NAN' on null in %s on line %d
|
||||
|
||||
Warning: Division by zero in %sbug76667.php on line %d
|
||||
Warning: Division by zero in %s on line %d
|
||||
|
||||
Warning: Undefined variable $undefined in %s on line %d
|
||||
|
||||
Warning: Trying to get property 'NAN' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'NAN' on null in %s on line %d
|
||||
|
||||
Warning: Division by zero in %sbug76667.php on line %d
|
||||
Warning: Division by zero in %s on line %d
|
||||
|
|
|
@ -12,5 +12,5 @@ try {
|
|||
var_dump($var);
|
||||
?>
|
||||
--EXPECT--
|
||||
Attempt to modify property 'prop' of non-object
|
||||
Attempt to modify property 'prop' on null
|
||||
NULL
|
||||
|
|
|
@ -25,13 +25,13 @@ try {
|
|||
?>
|
||||
--EXPECTF--
|
||||
Warning: Undefined variable $u1 in %s on line %d
|
||||
Attempt to assign property 'a' of non-object
|
||||
Attempt to assign property 'a' on null
|
||||
|
||||
Warning: Undefined variable $u2 in %s on line %d
|
||||
Attempt to increment/decrement property 'a' of non-object
|
||||
Attempt to increment/decrement property 'a' on null
|
||||
|
||||
Warning: Undefined variable $u3 in %s on line %d
|
||||
Attempt to increment/decrement property 'a' of non-object
|
||||
Attempt to increment/decrement property 'a' on null
|
||||
|
||||
Warning: Undefined variable $u4 in %s on line %d
|
||||
Attempt to modify property 'a' of non-object
|
||||
Attempt to modify property 'a' on null
|
||||
|
|
|
@ -29,10 +29,10 @@ var_dump($h);
|
|||
--EXPECTF--
|
||||
Warning: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Warning: Trying to get property 'a' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'a' on null in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Warning: Trying to get property 'b' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'b' on null in %s on line %d
|
||||
NULL
|
||||
|
|
|
@ -35,7 +35,7 @@ Warning: Undefined variable $d in %s on line %d
|
|||
|
||||
Warning: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Warning: Trying to get property '' of non-object in %s on line %d
|
||||
Warning: Attempt to read property '' on string in %s on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
|
|
@ -22,7 +22,7 @@ var_dump("foo$bar"());
|
|||
--EXPECTF--
|
||||
string(1) "f"
|
||||
|
||||
Warning: Trying to get property 'prop' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'prop' on string in %s on line %d
|
||||
NULL
|
||||
Call to a member function method() on string
|
||||
int(42)
|
||||
|
|
|
@ -19,6 +19,6 @@ test();
|
|||
--EXPECTF--
|
||||
string(1) "t"
|
||||
|
||||
Warning: Trying to get property 'prop' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'prop' on string in %s on line %d
|
||||
NULL
|
||||
Call to a member function method() on string
|
||||
|
|
|
@ -7,4 +7,4 @@ Cannot take property of a string
|
|||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Trying to get property 'bar' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'bar' on string in %s on line %d
|
||||
|
|
|
@ -133,7 +133,8 @@ ZEND_API const char *zend_get_type_by_const(int type) /* {{{ */
|
|||
ZEND_API const char *zend_zval_type_name(const zval *arg) /* {{{ */
|
||||
{
|
||||
ZVAL_DEREF(arg);
|
||||
return zend_get_type_by_const(Z_TYPE_P(arg));
|
||||
|
||||
return Z_ISUNDEF_P(arg) ? "null" : zend_get_type_by_const(Z_TYPE_P(arg));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
|
@ -621,17 +621,22 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_throw_non_object_erro
|
|||
|| opline->opcode == ZEND_POST_INC_OBJ
|
||||
|| opline->opcode == ZEND_POST_DEC_OBJ) {
|
||||
zend_throw_error(NULL,
|
||||
"Attempt to increment/decrement property '%s' of non-object",
|
||||
ZSTR_VAL(property_name));
|
||||
"Attempt to increment/decrement property '%s' on %s",
|
||||
ZSTR_VAL(property_name), zend_zval_type_name(object)
|
||||
);
|
||||
} else if (opline->opcode == ZEND_FETCH_OBJ_W
|
||||
|| opline->opcode == ZEND_FETCH_OBJ_RW
|
||||
|| opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG
|
||||
|| opline->opcode == ZEND_ASSIGN_OBJ_REF) {
|
||||
zend_throw_error(NULL,
|
||||
"Attempt to modify property '%s' of non-object", ZSTR_VAL(property_name));
|
||||
"Attempt to modify property '%s' on %s",
|
||||
ZSTR_VAL(property_name), zend_zval_type_name(object)
|
||||
);
|
||||
} else {
|
||||
zend_throw_error(NULL,
|
||||
"Attempt to assign property '%s' of non-object", ZSTR_VAL(property_name));
|
||||
"Attempt to assign property '%s' on %s",
|
||||
ZSTR_VAL(property_name), zend_zval_type_name(object)
|
||||
);
|
||||
}
|
||||
zend_tmp_string_release(tmp_property_name);
|
||||
|
||||
|
@ -1494,11 +1499,11 @@ static zend_never_inline ZEND_COLD void zend_wrong_string_offset(EXECUTE_DATA_D)
|
|||
zend_throw_error(NULL, "%s", msg);
|
||||
}
|
||||
|
||||
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_wrong_property_read(zval *property)
|
||||
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_wrong_property_read(zval *object, zval *property)
|
||||
{
|
||||
zend_string *tmp_property_name;
|
||||
zend_string *property_name = zval_get_tmp_string(property, &tmp_property_name);
|
||||
zend_error(E_WARNING, "Trying to get property '%s' of non-object", ZSTR_VAL(property_name));
|
||||
zend_error(E_WARNING, "Attempt to read property '%s' on %s", ZSTR_VAL(property_name), zend_zval_type_name(object));
|
||||
zend_tmp_string_release(tmp_property_name);
|
||||
}
|
||||
|
||||
|
|
|
@ -2014,7 +2014,7 @@ ZEND_VM_HOT_OBJ_HANDLER(82, ZEND_FETCH_OBJ_R, CONST|TMPVAR|UNUSED|THIS|CV, CONST
|
|||
if (OP2_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
ZEND_VM_C_GOTO(fetch_obj_r_finish);
|
||||
} while (0);
|
||||
|
|
|
@ -5220,7 +5220,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_
|
|||
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
goto fetch_obj_r_finish;
|
||||
} while (0);
|
||||
|
@ -7395,7 +7395,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_
|
|||
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
goto fetch_obj_r_finish;
|
||||
} while (0);
|
||||
|
@ -9651,7 +9651,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_
|
|||
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
goto fetch_obj_r_finish;
|
||||
} while (0);
|
||||
|
@ -13970,7 +13970,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_CONST_
|
|||
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
goto fetch_obj_r_finish;
|
||||
} while (0);
|
||||
|
@ -15351,7 +15351,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_TMPVAR
|
|||
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
goto fetch_obj_r_finish;
|
||||
} while (0);
|
||||
|
@ -16626,7 +16626,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_CV_HAN
|
|||
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
goto fetch_obj_r_finish;
|
||||
} while (0);
|
||||
|
@ -29416,7 +29416,7 @@ static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R
|
|||
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
goto fetch_obj_r_finish;
|
||||
} while (0);
|
||||
|
@ -31288,7 +31288,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMPVAR
|
|||
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
goto fetch_obj_r_finish;
|
||||
} while (0);
|
||||
|
@ -33683,7 +33683,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HAN
|
|||
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
goto fetch_obj_r_finish;
|
||||
} while (0);
|
||||
|
@ -37989,7 +37989,7 @@ static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R
|
|||
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
goto fetch_obj_r_finish;
|
||||
} while (0);
|
||||
|
@ -41471,7 +41471,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_TMPVAR_HAN
|
|||
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
goto fetch_obj_r_finish;
|
||||
} while (0);
|
||||
|
@ -46279,7 +46279,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER
|
|||
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
zend_wrong_property_read(offset);
|
||||
zend_wrong_property_read(container, offset);
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
goto fetch_obj_r_finish;
|
||||
} while (0);
|
||||
|
|
|
@ -25,8 +25,8 @@ print_r($arr);
|
|||
|
||||
?>
|
||||
--EXPECT--
|
||||
Attempt to assign property 'nodeValue' of non-object
|
||||
Attempt to assign property 'nodeValue' of non-object
|
||||
Attempt to assign property 'nodeValue' on null
|
||||
Attempt to assign property 'nodeValue' on null
|
||||
Array
|
||||
(
|
||||
[0] => Value
|
||||
|
|
|
@ -62,7 +62,7 @@ bool(false)
|
|||
testing property access
|
||||
string(4) "data"
|
||||
|
||||
Warning: Trying to get property 'textContent' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'textContent' on null in %s on line %d
|
||||
NULL
|
||||
testing offset not a long
|
||||
array(1) {
|
||||
|
@ -70,7 +70,7 @@ array(1) {
|
|||
string(4) "test"
|
||||
}
|
||||
|
||||
Warning: Trying to get property 'textContent' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'textContent' on null in %s on line %d
|
||||
bool(false)
|
||||
NULL
|
||||
array(1) {
|
||||
|
|
|
@ -58,6 +58,6 @@ Warning: DOMDocument::loadXML(): Failure to process entity file in Entity, line:
|
|||
|
||||
Warning: DOMDocument::loadXML(): Entity 'file' not defined in Entity, line: 4 in %s on line %d
|
||||
|
||||
Warning: Trying to get property 'firstChild' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'firstChild' on null in %s on line %d
|
||||
|
||||
Warning: Trying to get property 'nodeValue' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'nodeValue' on null in %s on line %d
|
||||
|
|
|
@ -448,6 +448,7 @@ static int zend_jit_disasm_init(void)
|
|||
REGISTER_HELPER(zend_jit_assign_op_to_typed_ref);
|
||||
REGISTER_HELPER(zend_jit_only_vars_by_reference);
|
||||
REGISTER_HELPER(zend_jit_invalid_array_access);
|
||||
REGISTER_HELPER(zend_jit_invalid_property_read);
|
||||
REGISTER_HELPER(zend_jit_prepare_assign_dim_ref);
|
||||
REGISTER_HELPER(zend_jit_pre_inc);
|
||||
REGISTER_HELPER(zend_jit_pre_dec);
|
||||
|
|
|
@ -1506,8 +1506,12 @@ static void ZEND_FASTCALL zend_jit_only_vars_by_reference(zval *arg)
|
|||
|
||||
static void ZEND_FASTCALL zend_jit_invalid_array_access(zval *container)
|
||||
{
|
||||
const char *type = Z_ISUNDEF_P(container) ? "null" : zend_zval_type_name(container);
|
||||
zend_error(E_WARNING, "Trying to access array offset on value of type %s", type);
|
||||
zend_error(E_WARNING, "Trying to access array offset on value of type %s", zend_zval_type_name(container));
|
||||
}
|
||||
|
||||
static void ZEND_FASTCALL zend_jit_invalid_property_read(zval *container, const char *property_name)
|
||||
{
|
||||
zend_error(E_WARNING, "Attempt to read property '%s' on %s", property_name, zend_zval_type_name(container));
|
||||
}
|
||||
|
||||
static zval * ZEND_FASTCALL zend_jit_prepare_assign_dim_ref(zval *ref) {
|
||||
|
|
|
@ -10537,7 +10537,7 @@ static int zend_jit_fetch_obj_read(dasm_State **Dst, const zend_op *opline, cons
|
|||
zval *member;
|
||||
uint32_t offset;
|
||||
zend_bool may_be_dynamic = 1;
|
||||
zend_jit_addr op1_addr = 0;
|
||||
zend_jit_addr op1_addr = 0, orig_op1_addr = 0;
|
||||
zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
|
||||
zend_jit_addr this_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, offsetof(zend_execute_data, This));
|
||||
zend_jit_addr prop_addr;
|
||||
|
@ -10552,7 +10552,7 @@ static int zend_jit_fetch_obj_read(dasm_State **Dst, const zend_op *opline, cons
|
|||
if (opline->op1_type == IS_UNUSED) {
|
||||
| GET_ZVAL_PTR FCARG1a, this_addr
|
||||
} else {
|
||||
op1_addr = OP1_ADDR();
|
||||
op1_addr = orig_op1_addr = OP1_ADDR();
|
||||
if (op1_info & MAY_BE_REF) {
|
||||
| LOAD_ZVAL_ADDR r0, op1_addr
|
||||
| ZVAL_DEREF r0, op1_info
|
||||
|
@ -10659,19 +10659,9 @@ static int zend_jit_fetch_obj_read(dasm_State **Dst, const zend_op *opline, cons
|
|||
| EXT_CALL zend_jit_undefined_op_helper, r0
|
||||
|1:
|
||||
}
|
||||
|.if X64
|
||||
| mov CARG1, E_WARNING
|
||||
| LOAD_ADDR CARG2, "Trying to get property '%s' of non-object"
|
||||
| LOAD_ADDR CARG3, Z_STRVAL_P(member)
|
||||
| EXT_CALL zend_error, r0
|
||||
|.else
|
||||
| sub r4, 4
|
||||
| push Z_STRVAL_P(member)
|
||||
| push "Trying to get property '%s' of non-object"
|
||||
| push E_WARNING
|
||||
| EXT_CALL zend_error, r0
|
||||
| add r4, 16
|
||||
|.endif
|
||||
| LOAD_ZVAL_ADDR FCARG1a, orig_op1_addr
|
||||
| LOAD_ADDR FCARG2a, Z_STRVAL_P(member)
|
||||
| EXT_CALL zend_jit_invalid_property_read, r0
|
||||
}
|
||||
| SET_ZVAL_TYPE_INFO res_addr, IS_NULL
|
||||
| jmp >9
|
||||
|
|
|
@ -17,4 +17,4 @@ try {
|
|||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined offset: 0 in %s on line %d
|
||||
Attempt to assign property 'y' of non-object
|
||||
Attempt to assign property 'y' on null
|
||||
|
|
|
@ -128,10 +128,10 @@ object(stdClass)#%d (2) {
|
|||
array(0) {
|
||||
}
|
||||
}
|
||||
Attempt to modify property 'abc' of non-object
|
||||
Attempt to modify property 'abc' on array
|
||||
array(0) {
|
||||
}
|
||||
Attempt to modify property 'abc' of non-object
|
||||
Attempt to modify property 'abc' on null
|
||||
NULL
|
||||
Attempt to modify property 'abc' of non-object
|
||||
Attempt to modify property 'abc' on string
|
||||
string(0) ""
|
||||
|
|
|
@ -60,5 +60,5 @@ object(PDORow)#%d (2) {
|
|||
string(19) "SELECT id FROM test"
|
||||
----------------------------------
|
||||
|
||||
Warning: Trying to get property 'queryString' of non-object in %s on line %d
|
||||
Warning: Attempt to read property 'queryString' on bool in %s on line %d
|
||||
NULL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue