Skip to content

Bug Report: Zend OPcache v8.4.21 Segfault in PHP 8.4.21 CLI Mode #22190

@twsh0305

Description

@twsh0305

Description

Reproduction Code

sudo -u www /usr/local/bin/wp cron event run --due-now --path=/www/wwwroot/wxsnote.cn

Actual Output

/www/server/cron/809fee71248ed83f577c92e6d7c6f57a: line 5: 4010020 Segmentation fault      sudo -u www /usr/local/bin/wp cron event run --due-now

dmesg Segfault Details

php[4010021]: segfault at 7f093d0b0e14 ip 00007f053fd47576 sp 00007ffe12cc8508 error 4 in opcache.so[7f053fce4000+e8000] likely on CPU 3

Multiple segfaults with the same signature (opcache.so) within the same time window:

[6043604.725752] php[4009217]: segfault at 7f827d2b0e14 ip 00007f7e7fd47576 sp 00007fffa10dc570 error 4 in opcache.so[7f7e7fce4000+e8000] likely on CPU 1
[6043626.416470] php84[4009346]: segfault at 7f4e078b0e14 ip 00007f4a0a347576 sp 00007fffac1f45f0 error 4 in opcache.so[7f4a0a2e4000+e8000] likely on CPU 0
[6043729.213806] php84[4009915]: segfault at 7f37e6cb0e14 ip 00007f33e9eb9576 sp 00007fffb85f4fb0 error 4 in opcache.so[7f33e9e56000+e8000] likely on CPU 0
[6043739.889890] php[4010021]: segfault at 7f093d0b0e14 ip 00007f053fd47576 sp 00007ffe12cc8508 error 4 in opcache.so[7f053fce4000+e8000] likely on CPU 3
[6044015.649818] php[4011481]: segfault at 7f7b5f727de0 ip 00007f7762347576 sp 00007ffeed0cd6c0 error 4 in opcache.so[7f77622e4000+e8000] likely on CPU 2
[6044029.712166] php[4011561]: segfault at 7fb4e02b0e14 ip 00007fb0e349c576 sp 00007ffc4cf92840 error 4 in opcache.so[7fb0e3439000+e8000] likely on CPU 2

Workaround (Verified)

sudo -u www php -d opcache.enable=0 /usr/local/bin/wp cron event run --due-now --path=/www/wwwroot/wxsnote.cn

Expected Output

Executed the cron event '...' in 0.xx seconds.
----------------------------------------------------------------------------
★[2026-xx-xx xx:xx:xx] Successful
----------------------------------------------------------------------------

Environment

Item Value
OS Debian GNU/Linux 12 (bookworm) x86_64
Kernel 6.1.0-44-amd64
PHP Version 8.4.21 (cli, NTS)
Zend Engine 4.4.21
Zend OPcache v8.4.21
JIT Mode 1205 (tracing + function opt level 5 + deopt)
JIT Buffer 128 MB
WP-CLI Version 2.12.0
Web Server User www (/sbin/nologin)
php.ini (CLI) /www/server/php/84/etc/php-cli.ini

Additional Notes

  • wp --info runs without issue (lightweight bootstrap only, no JIT compilation triggered).
  • wp plugin list triggers the same segfault when OPcache is enabled, confirming full codebase load is required to hit the bug.
  • All segfaults have error 4 — read access violation in user space, consistently at the same offset range within opcache.so (+e8000).
  • sudo -u user-switch is a contributing factor; the segfault is reliably reproducible under this condition.
  • The segfaults on this server are all from CLI invocations (WP-CLI via cron); PHP-FPM on this server is not affected.

Related Observation (Different Server)

On another server running the same PHP 8.4.x + OPcache + JIT stack, enabling JIT (opcache.jit=1205) caused intermittent PHP-FPM worker crashes, resulting in Nginx 502 Bad Gateway (upstream prematurely closed connection). Disabling JIT (opcache.jit=off) resolved the issue. The segfault signature was identical — opcache.so at the same offset range — suggesting a shared root cause in the JIT compiler backend.

Conclusion

Zend OPcache v8.4.21 with JIT (opcache.jit=1205) contains a segfault bug in PHP 8.4.21 CLI mode, stably reproducible when executing WP-CLI commands under a non-root user via sudo -u. Disabling OPcache (opcache.enable=0) eliminates the issue entirely.

A related crash with the same opcache.so signature has been observed on another server in PHP-FPM mode, causing 502 errors — pointing to a shared defect in the JIT tracing compiler's native code generation, triggered by specific PHP opcode patterns (common in WordPress).

This may affect all users running PHP 8.4.21 with JIT enabled on Debian 12.

PHP Version

PHP 8.4.21 (cli) (built: May 30 2026 12:15:48) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.21, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.21, Copyright (c), by Zend Technologies

Operating System

Debian 12.14

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions