Bug #60406 [Csd->Bgs]: file_exists() fopen() problems with URL (http)
| From: | cataphract@php.net | Date: | Sun, 11 Dec 2011 16:25:08 +0000 |
| Subject: | Bug #60406 [Csd->Bgs]: file_exists() fopen() problems with URL (http) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165802@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60406&edit=1
ID: 60406
Updated by: cataphract@php.net
Reported by: simon dot georget at gmail dot com
Summary: file_exists() fopen() problems with URL (http)
-Status: Closed
+Status: Bogus
Type: Bug
Package: *General Issues
Operating System: ubuntu oneiric
PHP Version: Irrelevant
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2011-11-30 09:35:36] simon dot georget at gmail dot com
Hi reeze,
Many thanks for your reply. It's clear.
Sorry for the inadapted bug report. Close it now.
------------------------------------------------------------------------
[2011-11-30 02:43:50] reeze dot xia at gmail dot com
Hi, simon:
@see http://docs.php.net/manual/en/wrappers.http.php
The Options "Wrapper Summary" section the http wrapper doesn't support stat()
and file_exists() rely on that. http stream wrapper support fopen.
file_exits() dones't support all the enabled stream wrappers.
You can visit http://cn2.php.net/manual/en/wrappers.php for a
full supported
streams.
thanks.
------------------------------------------------------------------------
[2011-11-29 17:01:04] simon dot georget at gmail dot com
**Actually fopen() works correctly!!!**
if(!fopen('http://maps.googleapis.com/maps/api/js?sensor=false',
'r')) {
echo 'Problem loading the url';
} else {
echo 'it works!';
}
returns it works!
------------------------------------------------------------------------
[2011-11-29 10:41:42] simon dot georget at gmail dot com
Description:
------------
I'm using the following version of PHP on ubuntu : PHP Version 5.3.6-13ubuntu3.2
and have problems checking if an url exists with both fopen() and file_exists() functions.
print_r(stream_get_wrappers()); returns :
Array ( [0] => https [1] => ftps [2] => compress.zlib [3] => compress.bzip2 [4] =>
php [5] => file [6] => glob [7] => data [8] => http [9] => ftp [10] => phar [11]
=> zip )
(test script is above)
Test script:
---------------
if(!file_exists('http://maps.googleapis.com/maps/api/js?sensor=false'))
{
echo 'Problem loading the url';
} else {
echo 'it works!';
}
Expected result:
----------------
it works!
Actual result:
--------------
Problem loading the url
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60406&edit=1