[prev in list] [next in list] [prev in thread] [next in thread]
List: php-cvs
Subject: [PHP-CVS] =?utf-8?q?svn:_/php/php-src/_branches/PHP=5F5=5F4/Zend/tests/bug60611.phpt_branches/PHP=5F
From: Xinchen_Hui <laruence () php ! net>
Date: 2011-12-28 6:46:12
Message-ID: svn-laruence-1325054772-321458-1565743369 () svn ! php ! net
[Download RAW message or body]
laruence Wed, 28 Dec 2011 06:46:12 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=321458
Log:
Fix #60613 (Segmentation fault with $cls->{expr}() syntax)
#now the behavior is like 5.3, a COMPILER_ERROR will be triggered
Bug: https://bugs.php.net/60613 (Assigned) Segmentation fault with $cls->{expr}() syntax
Changed paths:
U php/php-src/branches/PHP_5_4/Zend/tests/bug60611.phpt
U php/php-src/branches/PHP_5_4/Zend/zend_compile.c
U php/php-src/trunk/Zend/tests/bug60611.phpt
U php/php-src/trunk/Zend/zend_compile.c
Modified: php/php-src/branches/PHP_5_4/Zend/tests/bug60611.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/tests/bug60611.phpt 2011-12-28 04:31:21 UTC (rev 321457)
+++ php/php-src/branches/PHP_5_4/Zend/tests/bug60611.phpt 2011-12-28 06:46:12 UTC (rev 321458)
@@ -9,12 +9,6 @@
}
}
-Cls::{0}();
-Cls::{1.0}();
-Cls::{true}();
-Cls::{false}();
-Cls::{null}();
-
$cls = new Cls;
$cls->{0}();
$cls->{1.0}();
@@ -22,7 +16,12 @@
$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
Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-12-28 04:31:21 UTC (rev 321457)
+++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-12-28 06:46:12 UTC (rev 321458)
@@ -1975,8 +1975,9 @@
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 @@
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) &&
Modified: php/php-src/trunk/Zend/tests/bug60611.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug60611.phpt 2011-12-28 04:31:21 UTC (rev 321457)
+++ php/php-src/trunk/Zend/tests/bug60611.phpt 2011-12-28 06:46:12 UTC (rev 321458)
@@ -9,12 +9,6 @@
}
}
-Cls::{0}();
-Cls::{1.0}();
-Cls::{true}();
-Cls::{false}();
-Cls::{null}();
-
$cls = new Cls;
$cls->{0}();
$cls->{1.0}();
@@ -22,7 +16,12 @@
$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
Modified: php/php-src/trunk/Zend/zend_compile.c
===================================================================
--- php/php-src/trunk/Zend/zend_compile.c 2011-12-28 04:31:21 UTC (rev 321457)
+++ php/php-src/trunk/Zend/zend_compile.c 2011-12-28 06:46:12 UTC (rev 321458)
@@ -1975,8 +1975,9 @@
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 @@
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) &&
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic