#32532 [NEW]: fgets() fread() stream_get_content() functions return junk
| From: | destroyer at balticum-tv dot lt | Date: | Fri, 01 Apr 2005 12:14:00 +0000 |
| Subject: | #32532 [NEW]: fgets() fread() stream_get_content() functions return junk | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-76162@lists.php.net to get a copy of this message | ||
From: destroyer at balticum-tv dot lt
Operating system: Win32 / Linux
PHP version: 5CVS-2005-04-01 (dev)
PHP Bug Type: Sockets related
Bug description: fgets() fread() stream_get_content() functions return junk
Description:
------------
It seems that all these receive related functions return junk. They just
sometimes return 2000.
Before i downloaded a snapshot 5.0.x-dev they were returning not only
2000, but other text such as "10c" "2b3" etc.
Reproduce code:
---------------
$fp = @fsockopen($dom, 80, $errno, $errstr, 30);
stream_set_timeout($fp,20);
...
while (!feof($fp)) {
$result = fgets($fp, 4096);
if($result !== FALSE)
$out .= $result;
}
...
echo $out;
Expected result:
----------------
<HTML>
<BODY>
The test
Other text
</BODY>
</HTML>
Actual result:
--------------
<HTML>
<BODY>
2000
The test
2000
Other text
</BODY>
</HTML>
--
Edit bug report at http://bugs.php.net/?id=32532&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32532&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32532&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32532&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32532&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32532&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32532&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32532&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32532&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32532&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32532&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32532&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32532&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32532&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32532&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32532&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32532&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32532&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32532&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32532&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32532&r=mysqlcfg