php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79000 Non-blocking socket stream reports EAGAIN as error
Submitted: 2019-12-19 12:20 UTC Modified: -
From: nikic@php.net Assigned:
Status: Closed Package: Streams related
PHP Version: 7.4Git-2019-12-19 (Git) OS:
Private report: No CVE-ID: None
 [2019-12-19 12:20 UTC] nikic@php.net
Description:
------------
EAGAIN/EWOULDBLOCK writes result in a notice for non-blocking socket streams. Since PHP 7.4 additionally false will be returned.

Test script:
---------------
<?php error_reporting(E_ALL);
  
[$sock1, $sock2] = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);
$str = str_repeat('a', 1000000);
stream_set_blocking($sock1, false);
var_dump(fwrite($sock1, $str));
var_dump(fwrite($sock1, $str));


Expected result:
----------------
int(196608)
int(0)

Actual result:
--------------
Notice: fwrite(): send of 8192 bytes failed with errno=11 Resource temporarily unavailable in /home/nikic/php-7.4/t246.php on line 6
int(196608)

Notice: fwrite(): send of 8192 bytes failed with errno=11 Resource temporarily unavailable in /home/nikic/php-7.4/t246.php on line 7
bool(false)


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-12-19 12:29 UTC] nikic@php.net
The following pull request has been associated:

Patch Name: Fix bug #79000
On GitHub:  https://github.com/php/php-src/pull/5026
Patch:      https://github.com/php/php-src/pull/5026.patch
 [2019-12-20 10:38 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=10eb0b3110638c65f133c5ccc1cf2303db79e2bb
Log: Fixed bug #79000
 [2019-12-20 10:38 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC