Menu

#8 Private_DumpObjects does not report file write failure

open
nobody
5
2004-02-11
2004-02-11
Ron Gilson
No

Modify the Private_DumpObjects function in serialized.inc
to account for failed writes to files.

Following code demonstrates one method of resolving
the issue.

function Private_DumpObjects($filename, $objects) {

$result = FALSE;

if (is_array($objects)) {

$fp = fopen($filename, "w");
if(fwrite($fp, serialize($objects))){
$result = TRUE;
}else{
echo "Cannot write to $filename<BR>";
}
fclose($fp);

}
sleep(1);
#echo "<pre>";
#print_r($objects);
#echo "<pre></hr>";

return($result);
}

Discussion


Log in to post a comment.