You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
/proc/self paths resolve to the parent process after pcntl_fork() (realpath cache) #23986
After pcntl_fork(), a path under /proc/self that the parent already used resolves, in the child, to the parent's /proc/<pid>: the realpath cache kept the resolved symlink across the fork. The child reads the parent's process information.
parent: ok
child: /proc/self/stat says 3248499, getmypid() 3248500
But I expected this output instead:
parent: ok
child: /proc/self/stat says 3248500, getmypid() 3248500
clearstatcache(true) in the child works around it. The same happens with scandir('/proc/self/task') and the like, on NTS and ZTS builds. /proc/self (and /proc/thread-self) are symlinks whose target depends on the process reading them, so they shouldn't be cached, or the realpath cache could be cleared in the child of pcntl_fork().
Activity
Fix GH-23986: Clear the realpath cache in the child after pcntl_fork() (
Merge branch 'PHP-8.4' into PHP-8.5
Merge branch 'PHP-8.5' into PHP-8.6
Merge branch 'PHP-8.6'
Merge remote-tracking branch 'upstream/master' into io_hooks_poc