[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
| From: | Jorg Sowa | Date: | Sun, 18 Oct 2026 18:10:37 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142419@lists.php.net to get a copy of this message | ||
Author: Jorg Sowa (jorgsowa)
Date: 2026-10-18T20:09:10+02:00
Commit: https://github.com/php/php-src/commit/065b8264fb833f8936dcb84f3e2f4dd17fedf94c
Raw diff: https://github.com/php/php-src/commit/065b8264fb833f8936dcb84f3e2f4dd17fedf94c.diff
Merge branch 'PHP-8.5' into PHP-8.6
Changed paths:
M NEWS
M ext/posix/posix.c
Diff:
diff --git a/NEWS b/NEWS
index 49d1cb4e8054..1c41c3f86f92 100644
--- a/NEWS
+++ b/NEWS
@@ -75,6 +75,10 @@ PHP NEWS
. Fixed GH-24166 (Double-free in Phar::webPhar() in CGI without PATH_INFO).
(RigelYoung, Jakub Zelenka)
+- POSIX:
+ . Fixed posix_setrlimit() rejecting POSIX_RLIMIT_INFINITY on Solaris.
+ (Jorg Sowa)
+
- Readline:
. Fixed a crash in readline_info() when completion_append_character
contains a non-ASCII byte. (Weilin Du)
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 049d0bfdf19c..f6da93bfe8f3 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -1215,7 +1215,14 @@ PHP_FUNCTION(posix_getrlimit)
#endif /* HAVE_GETRLIMIT */
#ifdef HAVE_SETRLIMIT
-/* {{{ Set system resource consumption limits (POSIX.1-2001) */
+/* Solaris defines RLIM_INFINITY as (rlim_t)-3, so POSIX_RLIMIT_INFINITY is below -1 */
+#ifdef __sun
+# define POSIX_RLIM_VALID(v) ((v) >= -1 || (v) == (zend_long) RLIM_INFINITY)
+#else
+# define POSIX_RLIM_VALID(v) ((v) >= -1)
+#endif
+
+/* Set system resource consumption limits (POSIX.1-2001) */
PHP_FUNCTION(posix_setrlimit)
{
struct rlimit rl;
@@ -1227,12 +1234,12 @@ PHP_FUNCTION(posix_setrlimit)
Z_PARAM_LONG(max)
ZEND_PARSE_PARAMETERS_END();
- if (cur < -1) {
+ if (!POSIX_RLIM_VALID(cur)) {
zend_argument_value_error(2, "must be greater or equal to -1");
RETURN_THROWS();
}
- if (max < -1) {
+ if (!POSIX_RLIM_VALID(max)) {
zend_argument_value_error(3, "must be greater or equal to -1");
RETURN_THROWS();
}
@@ -1252,7 +1259,6 @@ PHP_FUNCTION(posix_setrlimit)
RETURN_TRUE;
}
-/* }}} */
#endif /* HAVE_SETRLIMIT */