PHP 4.0 Bug #9846: fopen() fails and gives Error 0 on NoContent URLs
| From: | bloch at incrementalimages dot com | Date: | Mon, 19 Mar 2001 21:56:02 +0000 |
| Subject: | PHP 4.0 Bug #9846: fopen() fails and gives Error 0 on NoContent URLs | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-49409@lists.php.net to get a copy of this message | ||
From: bloch@incrementalimages.com
Operating system: linux,irix,tru64
PHP version: 4.0.4pl1
PHP Bug Type: Filesystem function related
Bug description: fopen() fails and gives Error 0 on NoContent URLs
This bug might belong in the URL-related section.
I believe it to be a generic problem.
If you fopen() an URL
that returns with an HTTP Header of NoContent (204),
fopen() will fail with Error 0.
Failure would be ok if there was a specific error
code for NoContent URLs. Either that or returning
a handle that was already at eof would suffice.
As it is now, there's no way to tell the difference
between a bad (NotFound) URL and a NoContent URL.
Work-around it to use cURL to a temporary file
and check the HTTP_CODE with the undocumented
curl_getinfo() function. Of course, it seems
a little weird to require the temporary file
for a NoContent URL. But it works fine.
-Eric Bloch
bloch@incrementalimages.com
--
Edit Bug report at: http://bugs.php.net/?id=9846&edit=1