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:
Xinchen Hui 2011-12-28 06:46:12 +00:00
parent 44851f4146
commit 113c0a8cc7
2 changed files with 13 additions and 13 deletions

View File

@ -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

View File

@ -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) &&