From: chris dot baxter at ic24 dot net
Operating system: Windows XP and Redhat 7.2
PHP version: 4.3.1
PHP Bug Type: Sockets related
Bug description: fgets returning different result
Description:
------------
PHP 4.2.3 works as I would expect. When doing an fgets($string,3) I get 3
char's returned, in my instance ACK.
as from 4.3.1 up to and including the new 5.0b the same code only returns
AC I then have to do a further fgets to collect the K of my packet.
Reproduce code:
---------------
<?php
$connect_to = "localhost";
print "Connecting To: $connect_to <br>";
$fp = fsockopen ($connect_to,2100,&$error,$errdesc,60);
$out_data = "This is a test. Expecting 'ACK' returned followed a string
of data";
fputs($fp,$out_data);
$page = fgets($fp,3);
print "in1: $page <br>";
$page = fgets($fp,512);
print "in2: $page <br>";
?>
Expected result:
----------------
in1: ACK
in2: The rest of my data
Actual result:
--------------
in1: AC
in2: KThe rest of my data
--
Edit bug report at http://bugs.php.net/?id=24456&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=24456&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=24456&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24456&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24456&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24456&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24456&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24456&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24456&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24456&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24456&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24456&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24456&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24456&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24456&r=gnused