fwrite not writing

From: Date: Mon, 16 Apr 2001 05:20:29 +0000
Subject: fwrite not writing
Groups: php.general 
Request: Send a blank email to php-general+get-48704@lists.php.net to get a copy of this message
This function suddenly stopped working, and I just can't seem to figure out why. The only change made recently is that now the value of $force at calltime is sometimes true instead of being undefined or null. build_file("file_content","/path/to/file.inc","w",TRUE); function build_file($func_name,$filepath,$mode="w",$force=FALSE) { if($force or !file_exists($filepath) or !filesize($filepath)) //echo filesize($filepath) shows '0' { $content=$func_name(); //echo $content shows it's all there $fp=fopen($filepath,$mode); fwrite($fp,$content); rewind($fp); #temp test $read_back=fread($fp,100000); #temp test echo "<p>file content:</p>\n $read_back"; #temp test, displays nothing fclose($fp); } } I've tried putting echoes and "or die('Error on __LINE__')" on every line, checked all the variable values, and found no answers from that. Everything shows exactly as it should be except that the content that echoes out so nicely *doesn't ever get written to the file*. The function runs to the end without error and the file's modification date is even updated. But the file remains empty. I'm probably missing something ridiculously obvious, but would someone please be kind enough to point out what it is? Thank you!! -- CC

« previous php.general (#48704) next »