|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-10-31 03:57 UTC] john at alamak dot com dot sg
[2002-10-31 09:05 UTC] yohgaki@php.net
[2002-11-16 01:11 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 06:00:01 2025 UTC |
I get this all the time when I include a recursive function call. I've tried rewriting the function several ways and get intermitten Segmentation faults, saw a SuSe Linux report about scripts terminating with similar output in the web server error_log. I"ve tried just opening the fh and going down recursive directories with this, got the seg faults often.This version buffers the file names in an array, closes the directory handle then processes the array, to count certain types of files in the directory tree. Still segfaults often enough to make it unreliable. I turned on the autoflush in php.ini and it dies in this routine. FreeBSD 4.5-RELEASE Apache/1.3.26 (Unix) PHP/4.2.2 mod_ssl/2.8.9 OpenSSL/0.9.6g RegisterGlobals = On :) I use a perl script for my apache coplilation, here's my php_config line. --with-mysql=/usr/local --with-gd=/usr/local --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/ local/lib --with-zlib-dir=/usr/lib $xpm --with-freetype-dir=/usr/local/lib --with-mcrypt=/usr/local --with-gettext --wit h-xml --with-zlib=/usr --with-bz2=/usr/local --with-zip=/usr/local --with-mm=/usr/local --with-apache=../$apache --enable-ftp --disable-debug --enable-track-vars Here's the current version of the function function CountFiles($dir,$d) { global $home; global $prod_count; $farray = array(); $d++; if (is_dir("$home$dir")) { print "<!-- ISDIR dir=$dir level=$d -->\n"; if ($dfh = @opendir("$home$dir")) { while (($fil = readdir($dfh)) !== false) { if (!preg_match("/^\.+$/", $fil)) { array_push($farray,"$fil"); } } closedir($dfh); if (count($farray) > 0) { while (list ($key, $file) = each ($farray)) { if (is_dir("$home$dir/$file")) { CountFiles("$dir/$file",$d); flush(); } else if (preg_match("/^thumb_\w+\.|\.wav$|\.aif$/", $file)) { $prod_count++; print "<!-- POST dir=$dir/$file prod_count=$prod_count -->\n"; flush(); } } } } } flush(); } It's not entirely reproducible, but once I got a directory where it causes the segfault I can comment out this routine and it's okay, comment it back and reload and it segfaults. So in that sense it's reproducible. Restarting the web server has no effect. Though if I reload enough times sometimes the script completes, there is definitely some sort of bug, maybe the filehandle or array declaration isn't local or leaks out, not sure. Hope it's not something stupid I overlooked. :)