Skip test when opcache.enable_cli is enabled#1985
Open
GromNaN wants to merge 1 commit intomongodb:v2.xfrom
Open
Skip test when opcache.enable_cli is enabled#1985GromNaN wants to merge 1 commit intomongodb:v2.xfrom
GromNaN wants to merge 1 commit intomongodb:v2.xfrom
Conversation
OPcache constant-folds chr(ord('a')).'rray' into the literal "array",
which PHP then interns. This causes the test to fail locally when
opcache.enable_cli=1, even though the driver behavior is correct.
There was a problem hiding this comment.
Pull request overview
This PR updates the PHPT test suite to avoid a known failure mode when OPcache is enabled for CLI, which can change string interning behavior and invalidate the assumptions of an existing BSON test.
Changes:
- Add a
skip_if_opcache_enabled_cli()helper to centralize OPcache CLI skip logic. - Update
bug1839-005.phptto skip whenopcache.enable_cli=1.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tests/utils/skipif.php |
Adds a reusable skip helper for OPcache CLI affecting string interning/constant folding assumptions. |
tests/bson/bug1839-005.phpt |
Uses the new skip helper via basic-skipif.inc to prevent false failures when OPcache CLI is enabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
GromNaN
commented
Apr 14, 2026
| function createTypemap() | ||
| { | ||
| // Assemble the string so as to not have an interned string | ||
| $rootValue = chr(ord('a')) . 'rray'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
opcache.enable_cli=1, OPcache constant-foldschr(ord('a')).'rray'into the string literal"array", which PHP then interns. This causesbug1839-005.phptto fail locally even though the driver behavior is correct.Add a
skip_if_opcache_enabled_cli()helper totests/utils/skipif.phpand use it in the test.