From 00bfd25a6c4472c90bbf1fa184d1fb10b3b8fcf3 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Fri, 4 Sep 2026 09:40:55 +0000 Subject: [PATCH] Fix php://fd/ on platforms without getdtablesize() HAVE_UNISTD_H does not imply that getdtablesize() exists. Detect the function at configure time and fall back to INT_MAX when it is missing, matching the existing no-unistd path. --- configure.ac | 1 + ext/standard/php_fopen_wrapper.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b1ff51bcc2d1..0356298ebd98 100644 --- a/configure.ac +++ b/configure.ac @@ -559,6 +559,7 @@ AC_CHECK_FUNCS(m4_normalize([ funopen gai_strerror getcwd + getdtablesize getgrnam_r gethostname getloadavg diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index cca9445801f0..4f66ac892b78 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -346,7 +346,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c return NULL; } -#ifdef HAVE_UNISTD_H +#ifdef HAVE_GETDTABLESIZE dtablesize = getdtablesize(); #else dtablesize = INT_MAX;