Edit report at https://bugs.php.net/bug.php?id=60536&edit=1
ID: 60536 Patch added by: g...@php.net Reported by: scott...@php.net Summary: Traits Segfault Status: Open Type: Bug Package: Scripting Engine problem Operating System: ubuntu 11.11 PHP Version: 5.4SVN-2011-12-15 (SVN) Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: property005.phpt Revision: 1324052348 URL: https://bugs.php.net/patch-display.php?bug=60536&patch=property005.phpt&revision=1324052348 Previous Comments: ------------------------------------------------------------------------ [2011-12-16 16:17:37] g...@php.net Hi Laruence: Your patch was also what I had thought of for the first moment, however, that is not actually fixing the bug. The problem is another one. For some reason the property value does not get set properly. At least that is my current understanding. This leads to either some inconsistent ref count, or an inappropriately shared zval. Haven't figured that out yet. What you patch does is just changing the semantics of when properties are composed into the class. That is also something that happens to be broken (inconsistent with normal inheritance). I have updated tests that should describe the correct semantics for property handling. If you see where I do something stupid with the zvals, please let me know. Thanks Stefan ------------------------------------------------------------------------ [2011-12-16 15:57:01] larue...@php.net The following patch has been added/updated: Patch Name: bug60536.phpt Revision: 1324051021 URL: https://bugs.php.net/patch-display.php?bug=60536&patch=bug60536.phpt&revision=1324051021 ------------------------------------------------------------------------ [2011-12-16 15:54:15] larue...@php.net The following patch has been added/updated: Patch Name: bug60536.patch Revision: 1324050855 URL: https://bugs.php.net/patch-display.php?bug=60536&patch=bug60536.patch&revision=1324050855 ------------------------------------------------------------------------ [2011-12-15 20:38:27] scott...@php.net backtrace: #0 0x0000000100289c71 in zend_mm_check_ptr (heap=0x101000000, ptr=0x100c4f730, silent=1, __zend_filename=0x1005476a8 "/Users/macvicar/dev/php- src/branches/PHP_5_4/Zend/zend_vm_execute.h", __zend_lineno=10833, __zend_orig_filename=0x1005437a0 "/Users/macvicar/dev/php- src/branches/PHP_5_4/Zend/zend_execute.h", __zend_orig_lineno=88) at zend_alloc.c:1380 #1 0x000000010028c1ad in _zend_mm_free_int (heap=0x101000000, p=0x100c4f730, __zend_filename=0x1005476a8 "/Users/macvicar/dev/php- src/branches/PHP_5_4/Zend/zend_vm_execute.h", __zend_lineno=10833, __zend_orig_filename=0x1005437a0 "/Users/macvicar/dev/php- src/branches/PHP_5_4/Zend/zend_execute.h", __zend_orig_lineno=88) at zend_alloc.c:2064 #2 0x000000010028de9d in _efree (ptr=0x100c4f730, __zend_filename=0x1005476a8 "/Users/macvicar/dev/php-src/branches/PHP_5_4/Zend/zend_vm_execute.h", __zend_lineno=10833, __zend_orig_filename=0x1005437a0 "/Users/macvicar/dev/php- src/branches/PHP_5_4/Zend/zend_execute.h", __zend_orig_lineno=88) at zend_alloc.c:2436 #3 0x00000001003742c8 in i_zval_ptr_dtor [inlined] () at /Users/macvicar/dev/php-src/branches/PHP_5_4/Zend/zend_execute.h:88 #4 0x00000001003742c8 in ZEND_RETURN_SPEC_VAR_HANDLER (execute_data=0x1009802f8) at zend_execute.h:10833 #5 0x000000010032a882 in execute (op_array=0x1009bad50) at zend_vm_execute.h:410 #6 0x00000001002d733b in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:1272 #7 0x0000000100219973 in php_execute_script (primary_file=0x7fff5fbff170) at main.c:2476 ------------------------------------------------------------------------ [2011-12-15 20:37:07] scott...@php.net Description: ------------ Following code crashes. Test script: --------------- <?php trait T { private $x = 0; } class X { use T; } class Y extends X { use T; function x() { return ++$this->x; } } class Z extends Y { function z() { return ++$this->x; } } $a = new Z(); $a->x(); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60536&edit=1