Bug #60369 [Ver->Csd]: Crash with static property in trait
| From: | gron@php.net | Date: | Wed, 23 Nov 2011 21:25:07 +0000 |
| Subject: | Bug #60369 [Ver->Csd]: Crash with static property in trait | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165466@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60369&edit=1
ID: 60369
Updated by: gron@php.net
Reported by: vrana@php.net
Summary: Crash with static property in trait
-Status: Verified
+Status: Closed
Type: Bug
Package: Class/Object related
Operating System: Windows 7
PHP Version: 5.4.0RC1
Assigned To: gron
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Fixed in svn rev. 319727.
Previous Comments:
------------------------------------------------------------------------
[2011-11-23 21:24:21] gron@php.net
Automatic comment from SVN on behalf of gron
Revision: http://svn.php.net/viewvc/?view=revision&revision=319727
Log: Fixed Bug #60369 Crash with static property in trait
------------------------------------------------------------------------
[2011-11-23 20:55:37] gron@php.net
Thanks. I just missed the statics here.
Patch below, svn commit coming as soon as the tests have completed.
Thanks for the catch.
Index: Zend/zend_compile.c
===================================================================
--- Zend/zend_compile.c (revision 319492)
+++ Zend/zend_compile.c (working copy)
@@ -4271,10 +4286,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);
------------------------------------------------------------------------
[2011-11-23 20:38:53] vrana@php.net
Backtrace:
Entry point php!mainCRTStartup
Create time 11/23/2011 12:31:14 PM
Time spent in user mode 0 Days 0:0:0.15
Time spent in kernel mode 0 Days 0:0:0.0
Function Arg 1 Arg 2 Arg 3 Source
ntdll!ZwRaiseException+12 009ce3c4 009ce414 00000000
ntdll!KiUserExceptionDispatcher+2a 00000023 009cfb08 0000002b
php5!_php_import_environment_variables+39f 00000023 009cfb08 0000002b
php5!_php_import_environment_variables+39f 00000000 00000000 00000000
PHP5!ZEND_DO_BEGIN_CATCH+244In
php__PID__8020__Date__11_23_2011__Time_12_31_24PM__22__Second_Chance_Exception_C0000005.dmp the
assembly instruction at php5!zend_do_begin_catch+244 in C:\Program Files (x86)\PHP 5.4\php5.dll from
The PHP Group has caused an access violation exception (0xC0000005) when trying to read from memory
location 0x00000000 on thread 0
------------------------------------------------------------------------
[2011-11-23 20:35:18] vrana@php.net
Description:
------------
PHP crashes when there is a static property defined in a trait plus there is a normal property of
the same name in a class using this trait.
Test script:
---------------
<?php
trait PropertiesTrait {
static $same = true;
}
class Properties {
use PropertiesTrait;
public $same = true;
}
?>
Expected result:
----------------
Exit code: 0
Actual result:
--------------
Exit code: -1073741819
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60369&edit=1