Bug #11590 Updated: Segmentation fault when using an empty string as an array

From: Date: Wed, 20 Jun 2001 21:20:19 +0000
Subject: Bug #11590 Updated: Segmentation fault when using an empty string as an array
Groups: php.dev 
Request: Send a blank email to php-dev+get-57469@lists.php.net to get a copy of this message
ID: 11590 User Update by: phpbugs@ans-netz.de Status: Open Bug Type: Reproducible crash Operating system: Linux 2.4.3 i686 PHP Version: 4.0.5 Description: Segmentation fault when using an empty string as an array When i try this Script under FreeBSD 4.3-STABLE with PHP 4.0.5, and Apache 1.3.20 it run's without errors, or segfaults... Previous Comments: --------------------------------------------------------------------------- [2001-06-20 17:13:37] phpbugs@ans-netz.de Script: <?php class test { function call() { for($i=0;$i<50;$i++) { $result[$i]["threadid"] = "lala"; $result[$i]["threadid"] = "lala2"; } $a = array("1","2"); return $this->parse($a); } function parse($string,$result="") { for($i=0;$i<50;$i++) { $result_[$i]["threadid"] = $result[$i]["threadid"]; $result_[$i]["readcount"] = $result[$i]["readcount"]; } return $result_; } } class test2 { function output() { echo "hi"; $test = new test; return $test->call(); } } $test2 = new test2; print_r($test2->output()); ?> And Apache crashes with a Segfault: Wed Jun 20 23:12:17 2001] [notice] child pid 28682 exit signal Segmentation fault (11) [Wed Jun 20 23:12:47 2001] [notice] child pid 28692 exit signal Segmentation fault (11) Greetings Olli --------------------------------------------------------------------------- [2001-06-20 16:54:03] sniper@php.net Please include a complete but short script into this report which demonstrates this problem. --------------------------------------------------------------------------- [2001-06-20 16:46:03] phpbugs@ans-netz.de A Function in a class: function mParseStatisticData ($ids,$result="" ) { // some stuff inside; $result_[$pos]["threadid"] = $result[$pos]["threadid"];M $result_[$pos]["readcount"] = $result[$pos]["readcount"];M } I call these function with: $result_ = $this->mParseStatisticData($a); And the apache processes stops with a segmentation fault: [Wed Jun 20 17:46:20 2001] [notice] child pid 28697 exit signal Segmentation fault (11) How to fix it: function mParseStatisticData ($ids,$result=array() ) { Ok, it's wrong to use a string as an array... my fault.. but.. why my apache (1.3.20) crashes with a segfault? ;-) Greetings Olli --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=11590

« previous php.dev (#57469) next »