Conversation
- Pin actions/checkout, cache, upload-artifact, download-artifact to commit SHA - Replace manual submodule steps with actions/checkout submodules option - Remove unused submodule.ps1 - Drop unnecessary apk upgrade and manual safe.directory setup
Replace the Alpine PHP container matrix with shivammathur/setup-php running directly on ubuntu-latest: - Add a `ts` axis (nts/zts) and consolidate PHP 7.0-8.5 into a single version list - Install APCu through setup-php extensions instead of pecl install - Set fail-fast: false
The PHP<7.2 fallback smart_str_extract() expanded ZSTR_EMPTY_ALLOC() to CG(empty_string), which crashes under ZTS when evaluated inside the extension's inlined helper. Incremental compress/uncompress with BROTLI_PROCESS produces empty output and reaches this path, causing a segfault. Allocate the empty string via the core zend_string_init() symbol instead.
The APCu (un)serializer callbacks are invoked from APCu's translation unit, where brotli's per-module _tsrm_ls_cache is not refreshed for the current thread. On ZTS shared builds this left the cache stale, so PHP_VAR_SERIALIZE_INIT dereferenced a bad pointer when accessing basic globals via BG(), crashing with SIGSEGV. NTS passed because it has no TSRMLS cache and BG() resolves directly. Refresh the cache with ZEND_TSRMLS_CACHE_UPDATE() at the entry of both callbacks, mirroring php_brotli_output_encoding().
📝 WalkthroughWalkthroughThis pull request updates GitHub Actions workflows to pin marketplace actions to specific commits (checkout v6.0.2, cache v5.0.5, upload-artifact v7.0.1, download-artifact v8.0.1) and restructures the Linux CI matrix to target PHP 8.5–7.0 across nts/zts modes with conditional extension setup. In parallel, brotli.c is updated to fix PHP version compatibility in string initialization and add thread-safety cache initialization in serializer/unserializer functions. ChangesCI/CD Workflow Infrastructure Updates
Brotli Source Code Fixes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/windows.yaml (1)
73-80:⚠️ Potential issue | 🟠 Major | ⚡ Quick winFix
actions/cachecache scoping in Windows workflow to avoid cross-ref cache reuse.In
.github/workflows/windows.yaml, the cachekeydoesn’t includegithub.ref/github.ref_name, andrestore-keysis only${{ runner.os }}-php-, so caches from other refs can be restored.Suggested hardening
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: | C:\php\php-*.zip - key: ${{ runner.os }}-php-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }} + key: ${{ runner.os }}-${{ github.workflow }}-${{ github.ref }}-php-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }} restore-keys: | - ${{ runner.os }}-php- + ${{ runner.os }}-${{ github.workflow }}-${{ github.ref }}-php-🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/windows.yaml around lines 73 - 80, The cache key in the actions/cache step (the `key` and `restore-keys` entries) is too coarse and can restore caches from other branches/refs; update the `key` to include a ref-specific suffix (e.g., `${{ github.ref_name }}` or `${{ github.ref }}`) and tighten `restore-keys` accordingly so it only falls back to entries scoped to the same ref/name (for example include the same ref token in both `key` and `restore-keys` patterns); modify the cache step that uses `actions/cache` and the `key`/`restore-keys` fields to include the ref token to prevent cross-ref cache reuse.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In @.github/workflows/windows.yaml:
- Around line 73-80: The cache key in the actions/cache step (the `key` and
`restore-keys` entries) is too coarse and can restore caches from other
branches/refs; update the `key` to include a ref-specific suffix (e.g., `${{
github.ref_name }}` or `${{ github.ref }}`) and tighten `restore-keys`
accordingly so it only falls back to entries scoped to the same ref/name (for
example include the same ref token in both `key` and `restore-keys` patterns);
modify the cache step that uses `actions/cache` and the `key`/`restore-keys`
fields to include the ref token to prevent cross-ref cache reuse.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fee54e89-1486-47e5-8938-d99036bb1b99
📒 Files selected for processing (4)
.github/workflows/linux.yaml.github/workflows/submodule.ps1.github/workflows/windows.yamlbrotli.c
💤 Files with no reviewable changes (1)
- .github/workflows/submodule.ps1
Summary by CodeRabbit