PHP's fopen is supposed to
Returns a file pointer resource on success, or FALSE on error.
$f = fopen ($logfile, "a");
file_put_contents("/tmp/foo", gettype($f)."--".print_r ($f), TRUE);
The fopen is printing failed to open stream: Permission denied in the Apache log, which is what I expect in this particular case, however the error-handling logic that comes after isn't working because if ($f) succeeds.
The trace in /tmp/foo tells us
boolean--1
I guess I can use is_resource to make the error handling work, but this looks like a bug in PHP, no? Or is there something else that could bring about this situation?
or FALSE on error.. so type will be Boolean always. Php returns are Boolean values when the context is function