php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27024 fopen
Submitted: 2004-01-23 14:37 UTC Modified: 2004-01-29 21:16 UTC
From: mypass2002 at mail dot ru Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.3.5RC1 OS: Windows XP 5.1 build 2600
Private report: No CVE-ID: None
 [2004-01-23 14:37 UTC] mypass2002 at mail dot ru
Description:
------------
Apache/1.3.29 (Win32) PHP/4.3.5RC2-dev running...
            also tryed on 4.3.2

fopen("www.foo.com?data=safasfafa...64kb...dgdfg", "rb")
fails, because it's too much data, works well with less data

PHP.INI changes:
addes the lines for php_debugger
increased memory+time+input
changed docroot

Reproduce code:
---------------
$url="action=UPDATEROW&&updaterow=".urlencode(serialize($row_send));
m_get_url($url);//fopen ($baseurl.$url)

functio m_get_url($url)
{
global $otherurl;
$url2=$otherurl."?".$msg;

//dyes when opening with LOTS of data ... like more than 64kb
$a=fopen($url2,"rb") or die("...")
....
fclose($a);
}

Expected result:
----------------
to work with "infinite" paramerter data send

Actual result:
--------------
Warning: fopen(http://localhost/download.php?action=UPDATEROW&&updaterow=a%3A14%....
in c:\www\upload.php on line 44

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-23 16:22 UTC] mypass2002 at mail dot ru
also tryed on php 4.3.4 NOT 4.3.2
 [2004-01-24 19:20 UTC] pollita@php.net
The HTTP/1.1 protocol specifies a maximum length for GET queries of 2048 bytes.  PHP will, however,  attempt to send queries with longer lengths if you try to use them.  Whether the remote webserver will honor the query is entirely up to the remote server.  Most likely this is the case here, you've attempted to request a longer URL than the tareget webserver supports and it's responded with a failure message.

Take a look at $http_reponse_headers after the fopen() attempt and you should see the 5xx error produced by the remote server.

If you need to send more data than the remote webserver will accept in a GET request, consider sending a POST request (which will take a little more work on your part).  You can use example 2 provided on http://www.php.net/stream as a starting point.

P.S. - That code snipet wouldn't actually work without the http:// preamble.  It'd assume you wanted a local file named www.foo.com?whatever....
 [2004-01-27 10:05 UTC] mypass2002 at mail dot ru
well whatever... i guess you're right, but i still have to migrate to some other function, oh and 10x anyway :)
 [2004-01-29 21:16 UTC] magnus@php.net
Since it wasn't a bug in PHP, leave as bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 19:01:33 2024 UTC