#28437 [Fbk]: foreach on container object segfaults
| From: | wez@php.net | Date: | Tue, 18 May 2004 21:15:48 +0000 |
| Subject: | #28437 [Fbk]: foreach on container object segfaults | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-59753@lists.php.net to get a copy of this message | ||
ID: 28437
Updated by: wez@php.net
Reported By: fred at argus dot pt
Status: Feedback
Bug Type: Reproducible crash
Operating System: Linux SuSE 9.0
PHP Version: 5.0.0RC2
New Comment:
and the debugger; remove any third party extensions that you didn't
compile yourself.
Previous Comments:
------------------------------------------------------------------------
[2004-05-18 23:14:49] wez@php.net
Remove the ZendOptimizer and try again :)
------------------------------------------------------------------------
[2004-05-18 23:05:04] fred at argus dot pt
Amazing, I succeeded in getting a backtrace for the first time.
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 171)]
0x4076825d in zend_oe () from
/usr/local/Zend/lib/Optimizer-2.5.2/php-5.0.0/ZendOptimizer.so
(gdb) bt
#0 0x4076825d in zend_oe () from
/usr/local/Zend/lib/Optimizer-2.5.2/php-5.0.0/ZendOptimizer.so
#1 0x4073d68b in zend_oe () from
/usr/local/Zend/lib/Optimizer-2.5.2/php-5.0.0/ZendOptimizer.so
#2 0x4073d360 in zend_oe () from
/usr/local/Zend/lib/Optimizer-2.5.2/php-5.0.0/ZendOptimizer.so
#3 0x407e8d39 in db_ () from
/usr/local/Zend/lib/Debugger-3.5.0/php-5.0.0/ZendDebugger.so
#4 0x40423aa9 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /usr/local/php-5.0.0RC2/Zend/zend.c:1058
#5 0x403ecf61 in php_execute_script (primary_file=0xbffff290) at
/usr/local/php-5.0.0RC2/main/main.c:1630
#6 0x40456766 in php_handler (r=0x82c0cf8) at
/usr/local/php-5.0.0RC2/sapi/apache2handler/sapi_apache2.c:556
#7 0x080ab65b in ap_run_handler (r=0x82c0cf8) at config.c:152
#8 0x080abbde in ap_invoke_handler (r=0x82c0cf8) at config.c:358
#9 0x0809a7ab in ap_process_request (r=0x82c0cf8) at
http_request.c:246
#10 0x080964cc in ap_process_http_connection (c=0x82bc6a8) at
http_core.c:250
#11 0x080b551b in ap_run_process_connection (c=0x82bc6a8) at
connection.c:42
#12 0x080aa13d in child_main (child_num_arg=0) at prefork.c:609
#13 0x080aa24d in make_child (s=0x8197fe8, slot=0) at prefork.c:649
#14 0x080aa314 in startup_children (number_to_start=5) at
prefork.c:721
#15 0x080aa97d in ap_mpm_run (_pconf=0x8195120, plog=0x81cd200, s=0x0)
at prefork.c:940
#16 0x080afd9a in main (argc=2, argv=0xbffff5e4) at main.c:617
------------------------------------------------------------------------
[2004-05-18 21:07:37] wez@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
------------------------------------------------------------------------
[2004-05-18 21:01:57] fred at argus dot pt
Description:
------------
If I create an object with a container(array) instance variable, and
then use foreach to iterate over the container, then a segfault occurs.
If I copy the container to a temporary variable, and foreach over the
temp, the code works fine.
Similar code worked fine in PHP4, and I think 5.0.0RC1.
Reproduce code:
---------------
<?php
class user {
public $msgs = array();
}
class message {
public $text;
}
$user = new user;
$msg = new message;
$msg->text = "Hello";
$user->msgs[] = $msg;
foreach($user->msgs as $msg) {
echo "<br>Text is $msg->text";
}
echo "<br>Tests completed";
?>
Expected result:
----------------
Text is Hello
Tests completed
Actual result:
--------------
Blank Screen
Segfault message in main server error log.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28437&edit=1