note 96069 deleted from function.fopen by danbrown
| From: | danbrown@php.net | Date: | Sat, 06 Feb 2010 20:05:29 +0000 |
| Subject: | note 96069 deleted from function.fopen by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165716@lists.php.net to get a copy of this message | ||
Note Submitter: darkain at darkain dot com
----
"Returns a file pointer resource on success, or FALSE on error."
This is NOT always the case.
If PHP is compiled with the "--with-curlwrappers" option, then fopen() will return a
stream handle (NOT FALSE) even for pages that are Error404, Error500, etc.
This can easily be tested:
<?php
$file = @fopen('http://www.example.com/a-non-existant-page/',
'rb');
var_dump($file);
?>
Output with "--with-curlwrappers"
" resource(37) of type (stream) "
Output without "--with-curlwrappers"
" bool(false) "
It took me an entire day of hunting until I found out that this compile switch was used on my web
host but not on development machine. "--with-curlwrappers" should probably be better
documented.
I have documented my findings here: http://darkain.livejournal.com/492112.html