#19010 [Opn]: debug build segfaults on property assignment
| From: | tater at potatoe dot com | Date: | Wed, 21 Aug 2002 07:05:16 +0000 |
| Subject: | #19010 [Opn]: debug build segfaults on property assignment | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-17413@lists.php.net to get a copy of this message | ||
ID: 19010
User updated by: tater@potatoe.com
Reported By: tater@potatoe.com
Status: Open
Bug Type: Zend Engine 2 problem
Operating System: Mac OS X 10.1.5 / Darwin 5.5
PHP Version: 4CVS-2002-08-21
New Comment:
Argh, cut & paste problem, sorry. This is the code that works.
php -r 'class x { var $y; function z(){}} $a = new x; $b = new x;
$a->y=1; $b->y=2; echo "all ok\n";'
In other words, create the two objects first, and then make the
assigments.
Previous Comments:
------------------------------------------------------------------------
[2002-08-21 03:02:47] tater@potatoe.com
A particular sequence of object creations and property assignment
segfaults in ZE2 with --enable-debug.
I verified this on latest CVS, with a vanilla "configure
--enable-debug" build, running the CLI version.
This causes the segfault:
php -r 'class x { var $y; function z(){}} $a = new x; $a->y=1; $b = new
x; $b->y=2; echo "all ok\n";'
Just swapping two statements in there makes it work fine:
php -r 'class x { var $y; } $a = new x; $a->y=1; $b = new x; $b->y=2;
echo "all ok\n";'
This is what I can see in gdb:
Program received signal EXC_BAD_ACCESS, Could not access memory.
0x0017532c in _efree (ptr=0x5a5a5a5a, __zend_filename=0x1cf824
"/usr/local/book/php4/Zend/zend_object_handlers.c", __zend_lineno=88,
__zend_orig_filename=0x0, __zend_orig_lineno=0) at
/usr/local/book/php4/Zend/zend_alloc.c:219
219 CALCULATE_REAL_SIZE_AND_CACHE_INDEX(p->size);
(gdb) bt
#0 0x0017532c in _efree (ptr=0x5a5a5a5a, __zend_filename=0x1cf824
"/usr/local/book/php4/Zend/zend_object_handlers.c", __zend_lineno=88,
__zend_orig_filename=0x0, __zend_orig_lineno=0) at
/usr/local/book/php4/Zend/zend_alloc.c:219
#1 0x001a8ae0 in zend_std_write_property (object=0x5a36d8,
member=0x5a222c, value=0x5a25a8) at
/usr/local/book/php4/Zend/zend_object_handlers.c:88
#2 0x001b6384 in zend_assign_to_object (result=0x5a21f4, op1=0x5a220c,
op2=0x5a2224, value=0x5a25a8, Ts=0xbffff1e8) at
/usr/local/book/php4/Zend/zend_execute.c:304
#3 0x001af460 in execute (op_array=0x5a1978) at
/usr/local/book/php4/Zend/zend_execute.c:1520
#4 0x00185eb8 in zend_eval_string (str=0xbffffc45 "class x { var $y;
function z(){}} $a = new x; $a->y=1; $b = new x; $b->y=2; echo \"all
ok\\n\";", retval_ptr=0x0, string_name=0x1d076c "Command line code") at
/usr/local/book/php4/Zend/zend_execute_API.c:729
#5 0x001b9090 in main (argc=3, argv=0xbffffb78) at
/usr/local/book/php4/sapi/cli/php_cli.c:725
#6 0x00002714 in _start ()
#7 0x00002544 in start ()
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19010&edit=1