Repository navigation
Stdlib: thin AOT stream_get_contents php://memory via libc FILE* (#27437) - #27845
Merged
Merged
Conversation
NestedJIT StreamReadJitHelper→VmFs cannot see JitStreamIoKernel's FILE* table (php://memory is tmpfile()). Force a libc stream_get_contents ABI alongside fgets/fseek/ftell so fwrite+rewind+get_contents returns the buffer under thin standalone AOT. Co-authored-by: Cursor <cursoragent@cursor.com>
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
php://memoryas libctmpfile()(JitStreamIoKernel);fwrite/fread/rewindhit that FILE* table.stream_get_contentsstill NestedJIT'd throughStreamReadJitHelper→VmFs, which cannot see those handles — binary printed''(previously SIGSEGV on older tips).__compiler_stream_get_contentsafter NestedJIT (same pattern as fgets/fseek/ftell, Regression: AOT fscanf() compile fails — Unable to lookup phpc_round (ext/standard/scanf.c) #27663) so remaining-buffer fread matches Zend.php-src reference
ext/standard/file.c—PHP_FUNCTION(stream_get_contents)tmpfile()path inJitStreamIoKernel::emitTryFopenPhpMemory(Stdlib: stream_is_local() always false — php://memory and file streams must be true (ext/standard/streams.c) #10487)Test plan
'hi''he'/'ello'/'')StreamReadRuntimeShrinkTest+StreamIoRuntimeShrinkTest+AotRegressionFixtureCatalogTestOKstream_get_contents_php_memory.phptNot covered: full
ci-fast; non-seekable stream_get_contents under thin AOT (pipe) — seekable remaining-size path covers the issue repro.Made with Cursor