Bug #6788 Updated: dbase read functions lead to random segfault
| From: | sniper@php.net | Date: | Tue, 09 Oct 2001 08:40:56 +0000 |
| Subject: | Bug #6788 Updated: dbase read functions lead to random segfault | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-67590@lists.php.net to get a copy of this message | ||
ID: 6788
Updated by: sniper
Reported By: moron@industrial.org
Old Status: Open
Status: Closed
Bug Type: dBase related
Operating System: Redhat 6.2
PHP Version: 4.0.2
New Comment:
Please try the latest CVS snapshot from http://snaps.php.net/ as
this should now be fixed.
--Jani
Previous Comments:
------------------------------------------------------------------------
[2000-09-17 07:24:28] moron@industrial.org
I am experiencing some really annoying behaviour under PHP 4 that appears to be a bug in PHP but
maybe is some issue to do with upgrading? Anyways, using the DBF read functions results in random
seg faults (Apache's error_log states "child pid 12345 exit signal Segmentation
Fault"). This seems to have no rhyme or reason - it will crash on one run and work on fine on
the next. I thought it was a timeout issue initially but that seems to not be the case. I am
working with an 8000 line DBF file which I have another script that is trying to import it into a
MySQL database. The example code below is just to show the bug and just reads the file out. It
fails about 40% of the time for me. My "real" script dies consistently though, probably
due to the amount of other stuff going on. If you need an example dbf file please let me know.
<?PHP
if($fp = dbase_open("./import/prices1.DBF",0)) {
$num_records=dbase_numrecords($fp);
$x=1;
echo "<TABLE WIDTH=100%>\n";
while(($x<=800)&&($x<=$num_records)) {
echo "<TR>";
if(! ($row = dbase_get_record_with_names($fp, $x))) { $x++; next; }
reset($row);
while(key($row)) { echo "<TD>Field: ".key($row)."=".$row[ key($row)
]."</TD>\n"; next($row); }
unset($row);
flush();
$x++;
echo "</TR>\n";
}
flush();
printf("<TR><TD WIDTH=20%% ALIGN=RIGHT BgColor=#8080c0></TD><TD
WIDTH=20%% ALIGN=CENTER></TD><TD WIDTH=60%%><FONT face=\"arial,
helvitica\">%d records read</FONT></TD></TR>\n",$x-1);
echo "</TABLE>\n";
}
?>
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=6788&edit=1