stdlib: tempnam() prefix truncation, invalid-dir Notice, Z_PARAM_PATH (#4401) - #8014
Merged
Conversation
…#4401) Implement php-src tempnam parity in PHP (VmFsTempnam) instead of host @tempNam delegation: basename+63-char prefix cap, sys temp dir fallback with E_NOTICE, and ValueError on embedded NUL. Mirror behavior in __compiler_tempnam LLVM lowering for JIT/AOT. 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
tempnam()parity in PHP (ext/standard/VmFsTempnam.php) per php-srcext/standard/file.c+main/php_open_temporary_file.c:basename()+ 63-char prefix cap, invalid directory fallback tosys_get_temp_dir()withE_NOTICE, andValueErroron embedded NUL (Z_PARAM_PATH).VmString::coercePathBuiltinArg()for path builtins; wire VM/JIT through existingtempnambuiltin.__compiler_tempnamLLVM lowering (StringFsDirJit) for null-byte rejection, prefix normalization, fallback notice via__compiler_trigger_error, and retry against__compiler_sys_get_temp_dir.VmFsTempnamNativeuses thin libcmkstemp(3)FFI only.Closes #4401
php-src reference
ext/standard/file.c—PHP_FUNCTION(tempnam)main/php_open_temporary_file.c—php_open_temporary_fd_ex()Notice + fallbackVerification
VM/JIT repro output (parity with Zend on prefix length, fallback dir, null-byte
ValueError):PHPUnit: OK (10 tests, 10 assertions) for new compliance cases + existing
tempnam/tempnam_jit.Simple AOT compile smoke:
Note
AOT compile segfaults when combining
tempnam()+basename()+ long dynamic prefix (pre-existing on master); issue repro and compliance gates do not require that path.Made with Cursor