Skip to content

Commit 9130ddb

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Treat accept failing with SOCK_EAGAIN as success in CLI web server
2 parents fc35396 + 0099779 commit 9130ddb

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ PHP NEWS
1010
. Revert deprecation of __sleep() and __wakeup().
1111
They're now soft-deprecated. (Nicolas Grekas)
1212

13+
- CLI:
14+
. Fix useless "Failed to poll event" error logs due to EAGAIN in CLI server
15+
with PHP_CLI_SERVER_WORKERS. (leotaku)
16+
1317
- BcMath:
1418
. Fixed bug GH-20006 (Power of 0 of BcMath number causes UB). (nielsdos)
1519

sapi/cli/php_cli_server.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2712,14 +2712,16 @@ static zend_result php_cli_server_do_event_for_each_fd_callback(void *_params, p
27122712
struct sockaddr *sa = pemalloc(server->socklen, 1);
27132713
client_sock = accept(server->server_sock, sa, &socklen);
27142714
if (!ZEND_VALID_SOCKET(client_sock)) {
2715-
int err = php_socket_errno();
2716-
if (err != SOCK_EAGAIN && php_cli_server_log_level >= PHP_CLI_SERVER_LOG_ERROR) {
2715+
pefree(sa, 1);
2716+
if (php_socket_errno() == SOCK_EAGAIN) {
2717+
return SUCCESS;
2718+
}
2719+
if (php_cli_server_log_level >= PHP_CLI_SERVER_LOG_ERROR) {
27172720
char *errstr = php_socket_strerror(php_socket_errno(), NULL, 0);
27182721
php_cli_server_logf(PHP_CLI_SERVER_LOG_ERROR,
27192722
"Failed to accept a client (reason: %s)", errstr);
27202723
efree(errstr);
27212724
}
2722-
pefree(sa, 1);
27232725
return FAILURE;
27242726
}
27252727
if (SUCCESS != php_set_sock_blocking(client_sock, 0)) {

0 commit comments

Comments
 (0)