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: [email protected] 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] [email protected]
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] [email protected]
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] [email protected]
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jun 08 21:01:27 2025 UTC