Bug #79000 [PATCH]: Non-blocking socket stream reports EAGAIN as error
| From: | nikic@php.net | Date: | Thu, 19 Dec 2019 12:29:34 +0000 |
| Subject: | Bug #79000 [PATCH]: Non-blocking socket stream reports EAGAIN as error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224413@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79000&edit=1
ID: 79000
Patch added by: nikic@php.net
Reported by: nikic@php.net
Summary: Non-blocking socket stream reports EAGAIN as error
Status: Open
Type: Bug
Package: Streams related
PHP Version: 7.4Git-2019-12-19 (Git)
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2019-12-19 12:20:01] 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)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79000&edit=1