[php-src] PR #26031: Fix socket_accept() storing its error on the discarded socket
| From: | lacatoire | Date: | Wed, 02 Dec 2026 10:02:28 +0000 |
| Subject: | [php-src] PR #26031: Fix socket_accept() storing its error on the discarded socket | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41361@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/26031
Author: lacatoire
socket_accept() stored the error of a failed accept() on the
Socket allocated for the connection, which is destroyed right away, so
socket_last_error($listener) and socket_clear_error($listener) never saw
it. Store it on the listening socket, like socket_listen() and
socket_connect() do.
**To reproduce**
```php
<?php
$l = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($l, '127.0.0.1', 0);
socket_listen($l);
socket_set_nonblock($l);
socket_accept($l);
var_dump(socket_last_error($l));
```
Before: int(0)
After: int(11)