From:             ycallen at ndsisrael dot com
Operating system: RHEL linux
PHP version:      4.3.4
PHP Bug Type:     Apache related
Bug description:  fopen problem

Description:
------------
I do the following steps:

1.I run apache in debug mode(httpd -X).

2.I have a php script(send.php) that tries to access another php
script(recieve.php)using fopen with a url.The url points to
localhost[example : fopen("http://localhost/~php/recieve.php)].

3.The program hangs and eventually times out with the following warning :
"Warning: fopen(http://localhost/~php/recieve.php?param1=1m2=2): failed
to open stream: HTTP request failed! ^ in
/home/php/public_html/send.php on line 6"



This only happens when i run apache in debug mode.When i run apache in
regular mode then it works.

Reproduce code:
---------------
recieve.php:

<?php

echo "with GET<br>";

echo "my first param is: ".$_GET['param1']."<br>";

echo "my second param is: ".$_GET['param2']."<br>";

?>



send.php:

<?php

$url = "http://localhost/~php/recieve.php?param1=1&param2=2";;

$opts = array('http' => array('method' => "GET"));

$context = stream_context_create($opts);

echo "before fopen<br>";

$fp = fopen($url, "r", true, $context);

fpassthru($fp);

fclose($fp);

?>

Expected result:
----------------
before fopen

with GET

my first param is: 1

my second param is: 2



Actual result:
--------------
before fopen



Warning: fopen(http://localhost/~php/recieve.php?param1=1m2=2): failed
to open stream: HTTP request failed! ^ in
/home/php/public_html/send.php on line 6



Warning: fpassthru(): supplied argument is not a valid stream resource in
/home/php/public_html/send.php on line 7



Warning: fclose(): supplied argument is not a valid stream resource in
/home/php/public_html/send.php on line 8



-- 
Edit bug report at http://bugs.php.net/?id=27401&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27401&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27401&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27401&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27401&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27401&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27401&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27401&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27401&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27401&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27401&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27401&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27401&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27401&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27401&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27401&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27401&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27401&r=float

Reply via email to