From:             jeroen dot pulles at redslider dot net
Operating system: Windows 2000
PHP version:      5CVS-2004-03-10 (dev)
PHP Bug Type:     Sockets related
Bug description:  fwrite fails after writing 8k bytes

Description:
------------
When writing data to a socket, the program fails when writing more than
8192 bytes, irrespective of a given buffersize. 



Specifics:

- Windows 2000

- 5.0.0.0 RC1-dev (-200403101130)

- Command line interface (using cygwin)

- Almost no modules, just php_sockets.dll

- Default php.ini(-dist), apart from 

  E_ALL for the error logging



Note: 

The socket shouldn't be blocking, I didn't ask for it, and
set_stream_blocking(true) doesn't change it; I'm guessing this is some
irrelevant (for me) implementation detail for PHP.



Note: 

Writing to localhost does work.



Note:

Writing less than 8192 bytes does work (well, didn't check the exact size
where failure starts to happen).



Note:

No problems on my Linux box and PHP 5.*.



Reproduce code:
---------------
<?php

    $socket = fsockopen('some-other-host', 80, $errno, $errmessage);

    $message_body = '';

    for ($i = 0; $i < 4000; $i++) $message_body .= 'yadda ';

    $contentlength = strlen($message_body);

    $message = "POST / HTTP/1.0\r\n";

    $message .= "Host: some-other-host\r\n";

    $message .= "Content-Type: text/plain\r\n";

    $message .= "Content-Length: $contentlength\r\n";

    $message .= "\r\n";

    $message .= $message_body;

    fwrite($socket, $message);

    fclose($socket);

    print($errmessage);

    print("Done\n");

?>

Expected result:
----------------
Expecting to just see "Done"

Actual result:
--------------
[EMAIL PROTECTED] bin/php fwrite-bug.php



Notice: fwrite(): send of 8192 bytes failed with errno=0 A non-blocking
socket o

peration could not be completed immediately.

 in C:\home\wwwroot\aria\fwrite-bug.php on line 12

Done



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

Reply via email to