[php-src] master: Merge branch 'PHP-8.6'
| From: | Arnaud Le Blanc | Date: | Tue, 29 Sep 2026 16:09:54 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141697@lists.php.net to get a copy of this message | ||
Author: Arnaud Le Blanc (arnaud-lb)
Date: 2026-09-29T18:06:14+02:00
Commit: https://github.com/php/php-src/commit/008a00101129626ff47e3eb7cea7f5edde3a4d83
Raw diff: https://github.com/php/php-src/commit/008a00101129626ff47e3eb7cea7f5edde3a4d83.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
Fix GH-23986: Clear the realpath cache in the child after pcntl_fork() (#23987)
Changed paths:
A ext/pcntl/tests/gh23986.phpt
M ext/pcntl/pcntl.c
M main/main.c
Diff:
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 3a4d8ee7e25c..c73478fe5835 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -27,6 +27,7 @@
#include "php.h"
#include "ext/standard/info.h"
+#include "ext/standard/php_filestat.h"
#include "php_signal.h"
#include "php_ticks.h"
#include "zend_exceptions.h"
diff --git a/ext/pcntl/tests/gh23986.phpt b/ext/pcntl/tests/gh23986.phpt
new file mode 100644
index 000000000000..7b9976d50079
--- /dev/null
+++ b/ext/pcntl/tests/gh23986.phpt
@@ -0,0 +1,29 @@
+--TEST--
+GH-23986 (/proc/self paths resolve to the parent process after pcntl_fork())
+--EXTENSIONS--
+pcntl
+--SKIPIF--
+<?php
+if (!is_readable('/proc/self/stat')) die('skip /proc/self/stat not available');
+?>
+--FILE--
+<?php
+function proc_self_pid() {
+ return (int) explode(' ', file_get_contents('/proc/self/stat'))[0];
+}
+
+var_dump(proc_self_pid() === getmypid());
+$parent_inode = fileinode('/proc/self');
+
+$pid = pcntl_fork();
+if ($pid === 0) {
+ var_dump(fileinode('/proc/self') !== $parent_inode);
+ var_dump(proc_self_pid() === getmypid());
+ exit(0);
+}
+pcntl_waitpid($pid, $status);
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
diff --git a/main/main.c b/main/main.c
index 7a8d440c0d75..aed44e60c28e 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1814,6 +1814,7 @@ PHPAPI void php_child_init(void)
{
refresh_memory_manager();
zend_max_execution_timer_init();
+ php_clear_stat_cache(true, NULL, 0);
}
/* {{{ php_request_startup */