Stdlib: honor allow_url_include for script-style data:// opens (#32104) - #32126
Merged
Conversation
php_strip_whitespace(), highlight_file(), and show_source() now match php-src by refusing URL wrappers when allow_url_include is off, while file_get_contents() keeps using allow_url_fopen. Co-authored-by: Cursor <cursoragent@cursor.com>
4 tasks
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.
Summary
VmStreamIncludeOpenPolicyshared by VM and JIT/AOT for script/include-style stream opens (php-srcSTREAM_OPEN_FOR_INCLUDEparity)php_strip_whitespace(),highlight_file(), andshow_source()onallow_url_includefor URL wrappers likedata://file_get_contents()/file()on theallow_url_fopenpath unchangedphp-src reference:
ext/standard/basic_functions.c(php_strip_whitespace,highlight_file),main/streams/streams.cTest plan
./script/phpunit.sh --filter 'StreamIncludeOpenPolicyTest'→ OK (3 tests, 6 assertions)./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_strip_whitespace_data.php'''+ 2 Zend-shaped warnings; fgc still returns payload./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_highlight_file_data.php'false+ 3 warnings each; fgc still returns payload./script/docker-exec.sh -- bash -lc 'php bin/jit.php test/repro/maintainer_gap_strip_whitespace_data.php'→ same as VM./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && tmp=$(mktemp -d) && php bin/compile.php -o "$tmp/strip.bin" test/repro/maintainer_gap_strip_whitespace_data.php && "$tmp/strip.bin"'''+ wrapper-disabled warnings (after rebase onto Fix cold-build hello-world AOT verification on fresh helper cache (#32122) #32125)./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && tmp=$(mktemp -d) && php bin/compile.php -o "$tmp/hl.bin" test/repro/maintainer_gap_highlight_file_data.php && "$tmp/hl.bin"'--EXPECT--)file_get_contents('data://…')returnsfalse(pre-existing thin-runtime gap; VM/JIT fgc OK)Closes #32104.
Made with Cursor