Skip to content

Stdlib: file I/O null under strict_types throws TypeError (#17063) - #17071

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-17063-file-io-null-strict-types
Jul 7, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-17063-file-io-null-strict-types

Conversation

@PurHur

@PurHur PurHur commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #17063

Root cause

VM execute paths called coerceNonEmptyPathArg() / coerceFilenameArg() without the frame-aware InternalStrictArg::rejectNullString() step, so null coerced to "" and raised ValueError: Path cannot be empty instead of Zend's TypeError.

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_file_io_null_strict.php'
# file_get_contents=TypeError
# readfile=TypeError
# file_put_contents=TypeError

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter file_io_null_strict_typeerror'
# OK (4 tests, 4 assertions) — VM + JIT compliance

Made with Cursor

Route file_get_contents/readfile through coerceNonEmptyPathArgForFrame
and file_put_contents through filenameArgForFrame so caller strict_types
rejects null before empty-path ValueError, matching Zend Z_PARAM_PATH.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: file_get_contents()/readfile()/file_put_contents() null under strict_types — ValueError not TypeError (ext/standard/file.c)

1 participant