|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-07-08 05:47 UTC] sander@php.net
[2002-07-08 08:21 UTC] ray at unreal64 dot net
[2002-07-08 21:40 UTC] sniper@php.net
[2002-07-09 04:59 UTC] ray at unreal64 dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 22 04:00:01 2025 UTC |
Hi ! We are using OpenBSD as server-side OS, and Windoze for testing. I found a problem, which can be a bug. If not, or someone allready reported (I didn't find), I am sorry. This bug accurs only at Windoze - all works perfect under OpenBSD. I have code (pseudo): fopen(file1,"r") if (fopen(file2,"r")) { stat(file1); stat(file2); // check timestamp if (stat1 VS stat2) { read(file2) into array (restore cache); close(file1); close(file2); return; } close(file2); } // rebuild cache read(file1); close(file1); process file1 data // store cache if (fopen(file3,"w+b")) { fwrite(file3,serialize(...)); fclose(file3); /****** HERE Apache/php CRASHES } File1 is 'source'. File2 is 'cache' - read only. I check last modify time, if valid, then I read cache. If not, I process source, re-open cache for writing and store datas. At fclose process die. If I remove fclose, all works fine (other file operations, DB access, etc.). If I remove initiali fopen for cache and time checking (fstat), then fclose3 also works perfect. My own opinion: openning files/stating them/closing causes PHP die. Have a nice day, Don't kill me :o) Bye Ray There is original code (class function): // read strings file function cmdLngFile($fname) { $fnamec="../cache/".basename($fname); if (!file_exists($fname)) stlc_exit("lng file $fname not found"); $fd=@fopen($fname,"r"); if (empty($fd)) stlc_exit("can't read or empty lng $fname"); $fdc=@fopen($fnamec,"rb"); if (!empty($fdc)) { $statn=fstat($fd); $statc=fstat($fdc); // use cache if ($statn[9]<=$statc[9]) { $cache=fread($fdc,filesize($fnamec)); $this->lngs=array_merge($this->lngs,unserialize($cache)); fclose($fd); fclose($fdc); return; } // need rebuild cache... fclose($fdc); } $lng=fread($fd,filesize($fname)); fclose($fd); // process file contents $lnglen=strlen($lng); ... nothing interested here, jsut process language file and setup array $this->lngs in form array["language_id"] => "text" // store cache $fdcw=@fopen($fnamec,"w+b"); if (!empty($fdcw)) { $cache=serialize($this->lngs); fwrite($fdcw,$cache); fflush($fdcw); //!!!! PHP bug (?) - this falldown apache on windoze, BSD works // keep comment for windoze //fclose($fdcw); } }