From: php at 3r1c dot eu
Operating system: FreeBSD
PHP version: 5.2.6
PHP Bug Type: Streams related
Bug description: fwrite refuses to write more then 32k to non-blocking socket
Description:
------------
fwrite refuses to write more then 32k to non-blocking socket.
removing the stream_set_blocking line in my sample code will make the
program work properly.
It seems to get higher amount written on a localhost socket, about 120kb.
Reproduce code:
---------------
#!/usr/local/bin/php -q
<?php
// create a string with 100kb of zeros
$bytes = "";
for ($i = 0; $i < 100000; $i++){
$bytes .= "0";
}
$sock = @stream_socket_client('tcp://google.com:80', $errno, $errstr,
30);
stream_set_blocking($sock, 0);
$written = fwrite($sock, $bytes);
echo "Wrote $written bytes\n";
fclose($sock);
?>
Expected result:
----------------
Wrote 100000 bytes
Actual result:
--------------
Wrote 32768 bytes
--
Edit bug report at http://bugs.php.net/?id=46172&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46172&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46172&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46172&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46172&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=46172&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46172&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46172&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46172&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46172&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46172&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46172&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46172&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46172&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46172&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46172&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46172&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46172&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46172&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46172&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46172&r=mysqlcfg