note 96069 added to function.fopen
| From: | darkain at darkain dot com | Date: | Sat, 06 Feb 2010 19:46:43 +0000 |
| Subject: | note 96069 added to function.fopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165714@lists.php.net to get a copy of this message | ||
"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
----
Server IP: 192.41.40.227
Probable Submitter: 174.44.156.190
----
Manual Page -- http://www.php.net/manual/en/function.fopen.php
Edit -- https://master.php.net/note/edit/96069
Del: integrated -- https://master.php.net/note/delete/96069/integrated
Del: useless -- https://master.php.net/note/delete/96069/useless
Del: bad code -- https://master.php.net/note/delete/96069/bad+code
Del: spam -- https://master.php.net/note/delete/96069/spam
Del: non-english -- https://master.php.net/note/delete/96069/non-english
Del: in docs -- https://master.php.net/note/delete/96069/in+docs
Del: other reasons-- https://master.php.net/note/delete/96069
Reject -- https://master.php.net/note/reject/96069
Search -- https://master.php.net/manage/user-notes.php