[PHP-DEV] PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work From: Alan <email protected>
Date: 12/30/00

ID: 7880
User Update by: Alan <email protected>
Old-Status: Closed
Status: Open
Bug Type: *URL Functions
Description: PHP_URL_FOPEN doesn't work

Previous Comments:
---------------------------------------------------------------------------

[2000-12-30 19:55:06] sniper <email protected>
No feedback. Reopen if this really doesn't work with correct url.

--Jani

---------------------------------------------------------------------------

[2000-11-20 11:45:08] jason <email protected>
Ya you should be looking up index.php as hholzgra suggests,
but in looking at your truss output, It is behaving as if url wrappers was compiled out.

Can you try this test?

1. Lets verify the source is compiled correctly.
add --enable-debug to your php configure.
a. Remake and make sure that gcc is being called with -g. b. do a gdb httpd
c. run -X
d. hit ctrl-c (it might take a while to catch)
e. break php_fopen_wrapper
f. cont
g. open your test-script while its waiting
h. it should break when it trys to make the file request
i. hit n to step to the next line of code
j. see if it ever hits if(!(options & IGNORE_URL)){
k. if url wrappers is not compiled you would get
   if (options & USE_PATH........ instead

---------------------------------------------------------------------------

[2000-11-20 10:22:12] hholzgra <email protected>
ooops, looks like this was to early in the morning :(

but it might still be of interest what the output and
error messages look like if you take your code snippet
and just replace the '$fp=file($url)' line with '$fp=fopen($url,"r")'

it seems like file() fails to open the URL but still tries
to read from the file handle that is not valid in this case,
so that 'bad file number' is reported instead of the real cause
if failure ...

PS: i don't think this is realy related to it, but www.php.net/index.html
does not exist. trying to GET it will result in a 404 status and an
error page showing some search results, you should try
www.php.net/index.php instead, just to be sure ...

---------------------------------------------------------------------------

[2000-11-20 09:54:13] jason <email protected>
Actually he is using the correct usage. File takes a string calls fopen-wrappers to open a fp, and then returns an array

Alan, I will see If I can reproduce your findings

-Jason

---------------------------------------------------------------------------

[2000-11-20 07:01:04] hholzgra <email protected>
   $url = "http://www.php.net/index.html";
   $fp = file($url);

is simply wrong usage, try

   $url = "http://www.php.net/index.html";
   $fp = fopen($url,"r");
   $file_contents = file($fp);

instead

  

---------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online.

Full Bug description available at: http://bugs.php.net/?id=7880

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>