mirror of
https://github.com/php/php-src.git
synced 2024-12-15 04:45:03 +08:00
Fix #60613 (Segmentation fault with $cls->{expr}() syntax)
#now the behavior is like 5.3, a COMPILER_ERROR will be triggered
This commit is contained in:
parent
44851f4146
commit
113c0a8cc7
@ -9,12 +9,6 @@ class Cls {
|
||||
}
|
||||
}
|
||||
|
||||
Cls::{0}();
|
||||
Cls::{1.0}();
|
||||
Cls::{true}();
|
||||
Cls::{false}();
|
||||
Cls::{null}();
|
||||
|
||||
$cls = new Cls;
|
||||
$cls->{0}();
|
||||
$cls->{1.0}();
|
||||
@ -22,7 +16,12 @@ $cls->{true}();
|
||||
$cls->{false}();
|
||||
$cls->{null}();
|
||||
|
||||
echo "done";
|
||||
Cls::{0}();
|
||||
Cls::{1.0}();
|
||||
Cls::{true}();
|
||||
Cls::{false}();
|
||||
Cls::{null}();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
--EXPECTF--
|
||||
Fatal error: Method name must be a string in %sbug60611.php on line %d
|
||||
|
@ -1975,8 +1975,9 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */
|
||||
zval name;
|
||||
name = CONSTANT(last_op->op2.constant);
|
||||
if (Z_TYPE(name) != IS_STRING) {
|
||||
convert_to_string(&name);
|
||||
} else if (!IS_INTERNED(Z_STRVAL(name))) {
|
||||
zend_error(E_COMPILE_ERROR, "Method name must be a string");
|
||||
}
|
||||
if (!IS_INTERNED(Z_STRVAL(name))) {
|
||||
Z_STRVAL(name) = estrndup(Z_STRVAL(name), Z_STRLEN(name));
|
||||
}
|
||||
FREE_POLYMORPHIC_CACHE_SLOT(last_op->op2.constant);
|
||||
@ -2369,8 +2370,8 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na
|
||||
|
||||
if (method_name->op_type == IS_CONST) {
|
||||
char *lcname;
|
||||
if (Z_TYPE(method_name->u.constant) != IS_STRING) {
|
||||
convert_to_string(&method_name->u.constant);
|
||||
if (Z_TYPE(method_name->u.constant) != IS_STRING) {
|
||||
zend_error(E_COMPILE_ERROR, "Method name must be a string");
|
||||
}
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL(method_name->u.constant), Z_STRLEN(method_name->u.constant));
|
||||
if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(method_name->u.constant) &&
|
||||
|
Loading…
Reference in New Issue
Block a user