svn: /php/php-src/ branches/PHP_5_4/Zend/tests/traits/bug60369.phpt branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/tests/traits/bug60369.phpt
trunk/Zend/zend_compile.c
| From: | Stefan Marr | Date: | Wed, 23 Nov 2011 21:24:34 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_4/Zend/tests/traits/bug60369.phpt branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/tests/traits/bug60369.phpt trunk/Zend/zend_compile.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-67123@lists.php.net to get a copy of this message | ||
gron Wed, 23 Nov 2011 21:24:34 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=319727
Log:
Fixed Bug #60369 Crash with static property in trait
Bug: https://bugs.php.net/60369 (Verified) Crash with
static property in trait
Changed paths:
A php/php-src/branches/PHP_5_4/Zend/tests/traits/bug60369.phpt
U php/php-src/branches/PHP_5_4/Zend/zend_compile.c
A php/php-src/trunk/Zend/tests/traits/bug60369.phpt
U php/php-src/trunk/Zend/zend_compile.c
Added: php/php-src/branches/PHP_5_4/Zend/tests/traits/bug60369.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/tests/traits/bug60369.phpt (rev 0)
+++ php/php-src/branches/PHP_5_4/Zend/tests/traits/bug60369.phpt 2011-11-23 21:24:34 UTC (rev
319727)
@@ -0,0 +1,17 @@
+--TEST--
+Bug #60369 (Crash with static property in trait)
+--FILE--
+<?php
+
+trait PropertiesTrait {
+ static $same = true;
+}
+
+class Properties {
+ use PropertiesTrait;
+ public $same = true;
+}
+
+?>
+--EXPECTF--
+Fatal error: Properties and PropertiesTrait define the same property ($same) in the composition of
Properties. However, the definition differs and is considered incompatible. Class was composed in %s
on line %d
\ No newline at end of file
Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-11-23 21:21:10 UTC (rev 319726)
+++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-11-23 21:24:34 UTC (rev 319727)
@@ -4272,10 +4272,11 @@
/* this one is inherited, lets look it up in its own class */
zend_hash_quick_find(&coliding_prop->ce->properties_info, prop_name,
prop_name_length+1, prop_hash, (void **) &coliding_prop);
}
- if ((coliding_prop->flags & ZEND_ACC_PPP_MASK) == (property_info->flags &
ZEND_ACC_PPP_MASK)) {
+ if ( (coliding_prop->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))
+ == (property_info->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))) {
/* flags are identical, now the value needs to be checked */
if (property_info->flags & ZEND_ACC_STATIC) {
- not_compatible = (FAILURE == compare_function(&compare_result,
+ not_compatible = (FAILURE == compare_function(&compare_result,
ce->default_static_members_table[coliding_prop->offset],
ce->traits[i]->default_static_members_table[property_info->offset] TSRMLS_CC))
|| (Z_LVAL(compare_result) != 0);
Added: php/php-src/trunk/Zend/tests/traits/bug60369.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/bug60369.phpt (rev 0)
+++ php/php-src/trunk/Zend/tests/traits/bug60369.phpt 2011-11-23 21:24:34 UTC (rev 319727)
@@ -0,0 +1,17 @@
+--TEST--
+Bug #60369 (Crash with static property in trait)
+--FILE--
+<?php
+
+trait PropertiesTrait {
+ static $same = true;
+}
+
+class Properties {
+ use PropertiesTrait;
+ public $same = true;
+}
+
+?>
+--EXPECTF--
+Fatal error: Properties and PropertiesTrait define the same property ($same) in the composition of
Properties. However, the definition differs and is considered incompatible. Class was composed in %s
on line %d
\ No newline at end of file
Modified: php/php-src/trunk/Zend/zend_compile.c
===================================================================
--- php/php-src/trunk/Zend/zend_compile.c 2011-11-23 21:21:10 UTC (rev 319726)
+++ php/php-src/trunk/Zend/zend_compile.c 2011-11-23 21:24:34 UTC (rev 319727)
@@ -4272,10 +4272,11 @@
/* this one is inherited, lets look it up in its own class */
zend_hash_quick_find(&coliding_prop->ce->properties_info, prop_name,
prop_name_length+1, prop_hash, (void **) &coliding_prop);
}
- if ((coliding_prop->flags & ZEND_ACC_PPP_MASK) == (property_info->flags &
ZEND_ACC_PPP_MASK)) {
+ if ( (coliding_prop->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))
+ == (property_info->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))) {
/* flags are identical, now the value needs to be checked */
if (property_info->flags & ZEND_ACC_STATIC) {
- not_compatible = (FAILURE == compare_function(&compare_result,
+ not_compatible = (FAILURE == compare_function(&compare_result,
ce->default_static_members_table[coliding_prop->offset],
ce->traits[i]->default_static_members_table[property_info->offset] TSRMLS_CC))
|| (Z_LVAL(compare_result) != 0);