svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
| From: | Stefan Marr | Date: | Mon, 15 Aug 2011 08:29:48 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-65856@lists.php.net to get a copy of this message | ||
gron Mon, 15 Aug 2011 08:29:48 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=314921
Log:
Addendum for patch to bug #55214: Class name was freed before method literal referring to it.
# Thanks to Felipe for catching this.
# The fix duplicates the name into the literal to avoid the dependency
Bug: https://bugs.php.net/55214 (To be documented) use of
__CLASS__ within trait returns trait name not class name
Changed paths:
U php/php-src/branches/PHP_5_4/Zend/zend_compile.c
U php/php-src/trunk/Zend/zend_compile.c
Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-08-15 07:38:54 UTC (rev 314920)
+++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-08-15 08:29:48 UTC (rev 314921)
@@ -3544,7 +3544,7 @@
/* Only on merge into an actual class */
&& (ZEND_ACC_TRAIT != (target_ce->ce_flags & ZEND_ACC_TRAIT))) {
INIT_ZVAL(class_name_zv);
- ZVAL_STRINGL(&class_name_zv, target_ce->name, target_ce->name_length, 0);
+ ZVAL_STRINGL(&class_name_zv, target_ce->name, target_ce->name_length, 1);
class_name_literal = zend_add_literal(&fe->op_array, &class_name_zv TSRMLS_CC);
opcode_copy[i].op1.zv = &fe->op_array.literals[class_name_literal].constant;
}
@@ -3564,7 +3564,7 @@
/* Only on merge into an actual class */
&& (ZEND_ACC_TRAIT != (target_ce->ce_flags & ZEND_ACC_TRAIT))) {
INIT_ZVAL(class_name_zv);
- ZVAL_STRINGL(&class_name_zv, target_ce->name, target_ce->name_length, 0);
+ ZVAL_STRINGL(&class_name_zv, target_ce->name, target_ce->name_length, 1);
class_name_literal = zend_add_literal(&fe->op_array, &class_name_zv TSRMLS_CC);
opcode_copy[i].op2.zv = &fe->op_array.literals[class_name_literal].constant;
}
Modified: php/php-src/trunk/Zend/zend_compile.c
===================================================================
--- php/php-src/trunk/Zend/zend_compile.c 2011-08-15 07:38:54 UTC (rev 314920)
+++ php/php-src/trunk/Zend/zend_compile.c 2011-08-15 08:29:48 UTC (rev 314921)
@@ -3544,7 +3544,7 @@
/* Only on merge into an actual class */
&& (ZEND_ACC_TRAIT != (target_ce->ce_flags & ZEND_ACC_TRAIT))) {
INIT_ZVAL(class_name_zv);
- ZVAL_STRINGL(&class_name_zv, target_ce->name, target_ce->name_length, 0);
+ ZVAL_STRINGL(&class_name_zv, target_ce->name, target_ce->name_length, 1);
class_name_literal = zend_add_literal(&fe->op_array, &class_name_zv TSRMLS_CC);
opcode_copy[i].op1.zv = &fe->op_array.literals[class_name_literal].constant;
}
@@ -3564,7 +3564,7 @@
/* Only on merge into an actual class */
&& (ZEND_ACC_TRAIT != (target_ce->ce_flags & ZEND_ACC_TRAIT))) {
INIT_ZVAL(class_name_zv);
- ZVAL_STRINGL(&class_name_zv, target_ce->name, target_ce->name_length, 0);
+ ZVAL_STRINGL(&class_name_zv, target_ce->name, target_ce->name_length, 1);
class_name_literal = zend_add_literal(&fe->op_array, &class_name_zv TSRMLS_CC);
opcode_copy[i].op2.zv = &fe->op_array.literals[class_name_literal].constant;
}