ID: 24485 Comment by: ericvanblokland at gmail dot com Reported By: gomez at efrei dot fr Status: Assigned Bug Type: Scripting Engine problem Operating System: * PHP Version: 4CVS, 5CVS (2004-04-13) Assigned To: derick New Comment:
Where do you live? If it's anywhere near here I'll buy you a beer (or two)!! I'm working on a huge project, with extremely large and complex object constructions, and I have been fighting against segmentation faults for weeks now which is a mayor setback as the deadline is comming closer. I'm still trying to narrow down the cause of these problems but it seems that some construction of circular references (That might exist as a result of this bug) causes memory leaks and crashes php on simple variable assignments. To make me more desperate, after installing the latest rpm in debug-mode memory leaks were reported once and never after and de segmentation faults disappeared. Using that same rpm without debug mode resulted in the same segaults. I've posted this before http://bugs.php.net/bug.php?id=31624 but that bug-report got broken and I've been investigating the cause more before reposting. (I reproduced my problem there with the latest CVS of that time) However, as this bug might be causing the exceptional conditions that causes my segfaults (Copying, a complex, reference-rich object to another location in a session, resulting in another reference), I will wait looking into that any further for now. I can only pray it fixes it. Sorry for the long story, but as it might be related I feld the need to post it here. Once more, thanks a lot! Previous Comments: ------------------------------------------------------------------------ [2005-02-03 21:59:04] [EMAIL PROTECTED] This should NOT be a problem in PHP - but it is one in PHP 4. I've seen this too and have a patch almost ready that backports the fixes done in PHP 5. ------------------------------------------------------------------------ [2005-02-03 21:16:08] ericvanblokland at gmail dot com Ain't it time to think about a fix? (Reproduced with 4.3.10 on fedora core 2 in debug-mode) The references created due to this bug, might be the cause my script keeps segfaulting. About this I've posted a report before, and will post another in the near future. So I won't mention anything about that hear just yet. ------------------------------------------------------------------------ [2005-01-21 00:19:11] [EMAIL PROTECTED] Still exists in 4.3, but has been already fixed in both 5.x branches. ------------------------------------------------------------------------ [2003-07-17 14:03:27] [EMAIL PROTECTED] The following piece produces a similar result: <?php class foo {} $a = array(new foo()); function show(&$this) { return 5; } show($a[0]); var_dump($a); ?> ------------------------------------------------------------------------ [2003-07-03 10:17:47] gomez at efrei dot fr Description: ------------ In an array, classes become classes references when I use a function member. Because of that, I don't copy it anymore, I just produce more pointers to it. (see the '&' in the var dump) If you comment the magic line, the bug won't appear. Tested under linux (php 4.1.2 and 4.2.3) and windows (php 4.3.2) Reproduce code: --------------- <?php class AAAAA { var $value; function AAAAA() {} function show() { return 5; } } $A = array(new AAAAA()); $A[0]->show(); /* magic line */ $A[0]->value = 'A'; $B = $A; $B[0]->value = 'B'; echo $A[0]->value.$B[0]->value; echo "\n"; var_dump( $A ); ?> Expected result: ---------------- AB array(1) { [0]=> object(aaaaa)(1) { ["value"]=> string(1) "A" } } Actual result: -------------- BB array(1) { [0]=> &object(aaaaa)(1) { ["value"]=> string(1) "B" } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24485&edit=1
