From 11db99e07da8db6a01b215f57fbfd8567560eae7 Mon Sep 17 00:00:00 2001 From: Lisachenko Alexander Date: Thu, 20 Aug 2026 16:00:18 +0000 Subject: [PATCH 1/2] ci: run the test suite and request-boundary gate under opcache Two new matrix jobs prove the package under an opcache-enabled engine on PHP 8.4 and 8.5: tests-opcache runs the whole PHPUnit suite with opcache.enable_cli=1, and request-boundary-opcache drives the FastCGI gate with opcache.enable=1, so preloaded-style SHM literals exercise the IS_STR_PERMANENT keep-by-pointer branch of Persister::persistStringSlot() across real RINIT/RSHUTDOWN boundaries. Guard steps assert opcache is genuinely active in the matching SAPI before anything runs. The four existing jobs now pin opcache.enable=0 and opcache.enable_cli=0 explicitly: the CGI SAPI defaults opcache.enable to On, so the request-boundary gate ran under opcache accidentally on runners shipping the extension enabled, which would have made the postures indistinguishable. JIT stays off in every leg because it rewrites the executor internals z-engine hooks into. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_018oCKjaGwG27wE9rWdCqa6p --- .github/workflows/ci.yml | 69 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2a6f8d..62c87aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: with: php-version: ${{ matrix.php }} extensions: ffi - ini-values: ffi.enable=1, zend.assertions=1, opcache.jit=off + ini-values: ffi.enable=1, zend.assertions=1, opcache.enable=0, opcache.enable_cli=0, opcache.jit=off coverage: none - name: Validate composer manifest @@ -32,6 +32,33 @@ jobs: - name: Unit and lifecycle tests run: vendor/bin/phpunit + tests-opcache: + name: Tests under opcache (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: ['8.4', '8.5'] + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: ffi, opcache + # JIT stays off: it rewrites the executor internals z-engine hooks into + ini-values: ffi.enable=1, zend.assertions=1, opcache.enable=1, opcache.enable_cli=1, opcache.jit=off, opcache.jit_buffer_size=0 + coverage: none + + - name: Assert opcache is active in the CLI SAPI + run: php -r 'exit((int) !(function_exists("opcache_get_status") && opcache_get_status(false) !== false && ini_get("opcache.enable_cli")));' + + - name: Install dependencies + run: composer install --no-interaction --no-progress + + - name: Unit and lifecycle tests under opcache + run: vendor/bin/phpunit + soak: name: Flat-memory soak (5k request cycles, PHP ${{ matrix.php }}) runs-on: ubuntu-latest @@ -46,7 +73,7 @@ jobs: with: php-version: ${{ matrix.php }} extensions: ffi - ini-values: ffi.enable=1, opcache.jit=off + ini-values: ffi.enable=1, opcache.enable=0, opcache.enable_cli=0, opcache.jit=off coverage: none - name: Install dependencies @@ -69,7 +96,7 @@ jobs: with: php-version: ${{ matrix.php }} extensions: ffi - ini-values: ffi.enable=1, opcache.jit=off + ini-values: ffi.enable=1, opcache.enable=0, opcache.enable_cli=0, opcache.jit=off coverage: none - name: Install dependencies @@ -92,7 +119,10 @@ jobs: with: php-version: ${{ matrix.php }} extensions: ffi - ini-values: ffi.enable=1, opcache.jit=off + # opcache.enable=0 pins the posture: the CGI SAPI defaults it to On, so + # without the pin this gate silently runs under opcache on runners that + # ship the extension enabled + ini-values: ffi.enable=1, opcache.enable=0, opcache.enable_cli=0, opcache.jit=off coverage: none - name: Install FastCGI client @@ -103,3 +133,34 @@ jobs: - name: Objects survive real RINIT/RSHUTDOWN boundaries run: bash tools/request-boundary/run.sh 100 + + request-boundary-opcache: + name: True multi-request gate under opcache (php-cgi/FastCGI, PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: ['8.4', '8.5'] + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: ffi, opcache + ini-values: ffi.enable=1, opcache.enable=1, opcache.jit=off, opcache.jit_buffer_size=0 + coverage: none + + - name: Install FastCGI client + run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libfcgi-bin + + - name: Assert opcache is active in the CGI SAPI + run: | + printf ' "$RUNNER_TEMP/opcache-guard.php" + php-cgi -q "$RUNNER_TEMP/opcache-guard.php" > /dev/null + + - name: Install dependencies + run: composer install --no-interaction --no-progress + + - name: Objects survive real RINIT/RSHUTDOWN boundaries under opcache + run: bash tools/request-boundary/run.sh 100 From c3cede2cc5841b33e888aa1e8fc0d6a0365f4a6b Mon Sep 17 00:00:00 2001 From: Lisachenko Alexander Date: Thu, 20 Aug 2026 16:11:02 +0000 Subject: [PATCH 2/2] ci: keep the opcache gate local-only and let dependabot track actions Review feedback on #31: the request-boundary-opcache job comes out of CI and stays as instructions for driving the gate under opcache locally (the CGI SAPI defaults opcache.enable to On, so an unpinned php-cgi runs it that way already), and a dependabot config keeps the workflow actions current. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_018oCKjaGwG27wE9rWdCqa6p --- .github/dependabot.yml | 6 ++++++ .github/workflows/ci.yml | 41 +++++++++++----------------------------- 2 files changed, 17 insertions(+), 30 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ca79ca5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62c87aa..2de94a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -134,33 +134,14 @@ jobs: - name: Objects survive real RINIT/RSHUTDOWN boundaries run: bash tools/request-boundary/run.sh 100 - request-boundary-opcache: - name: True multi-request gate under opcache (php-cgi/FastCGI, PHP ${{ matrix.php }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - php: ['8.4', '8.5'] - steps: - - uses: actions/checkout@v4 - - - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: ffi, opcache - ini-values: ffi.enable=1, opcache.enable=1, opcache.jit=off, opcache.jit_buffer_size=0 - coverage: none - - - name: Install FastCGI client - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libfcgi-bin - - - name: Assert opcache is active in the CGI SAPI - run: | - printf ' "$RUNNER_TEMP/opcache-guard.php" - php-cgi -q "$RUNNER_TEMP/opcache-guard.php" > /dev/null - - - name: Install dependencies - run: composer install --no-interaction --no-progress - - - name: Objects survive real RINIT/RSHUTDOWN boundaries under opcache - run: bash tools/request-boundary/run.sh 100 +# The multi-request gate can also be driven under opcache - locally only, not as a +# CI job. The CGI SAPI defaults opcache.enable to On, so any php-cgi whose ini does +# not pin it off (as the job above does) caches the gate script in opcache SHM, +# where its compile-time literals become IS_STR_PERMANENT strings that the persister +# keeps by pointer instead of copying: +# +# bash tools/request-boundary/run.sh 100 +# +# with Zend OPcache loaded and opcache.enable=1 (keep opcache.jit=off and +# opcache.jit_buffer_size=0 - the JIT rewrites the executor internals z-engine +# hooks into).