[php-src] PHP-8.6: Merge branch 'PHP-8.4' into PHP-8.5
| From: | Arnaud Le Blanc | Date: | Tue, 29 Sep 2026 16:09:48 +0000 |
| Subject: | [php-src] PHP-8.6: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141695@lists.php.net to get a copy of this message | ||
Author: Arnaud Le Blanc (arnaud-lb)
Date: 2026-09-29T18:05:35+02:00
Commit: https://github.com/php/php-src/commit/35a9f7712353c19c8b8060ac20f09d42ce15399b
Raw diff: https://github.com/php/php-src/commit/35a9f7712353c19c8b8060ac20f09d42ce15399b.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
Fix GH-23986: Clear the realpath cache in the child after pcntl_fork() (#23987)
Changed paths:
A ext/pcntl/tests/gh23986.phpt
M NEWS
M ext/pcntl/pcntl.c
M main/main.c
Diff:
diff --git a/NEWS b/NEWS
index c0ccd2518511..60b47d319103 100644
--- a/NEWS
+++ b/NEWS
@@ -93,6 +93,8 @@ PHP NEWS
an exception is pending. (nicolas-grekas)
. Fixed pcntl_signal_dispatch() dropping the signals queued behind a handler
that throws. (nicolas-grekas)
+ . Fixed bug GH-23986 (/proc/self paths resolve to the parent process after
+ pcntl_fork()). (Lazizbek Ergashev)
- PDO:
. Fixed PDOStatement::getColumnMeta() reading out of bounds for an invalid
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 912e13ac48a7..e2443bb930bf 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -29,6 +29,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 4d1859e7e4d4..ad7ae8a5177e 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1866,6 +1866,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 */