Stdlib: getenv() local_only second argument — VM + AOT (#3710) - #3770
Merged
Merged
Conversation
Owner
Author
Maintainer review (local Docker)Verified on `agent/stdlib-getenv-local-only` via `./script/docker-exec.sh`:
Not merging until JIT compliance is green or explicitly scoped VM+AOT-only with JITTest skips documented on #3710. VM semantics for `local_only` and `putenv` no-return fix look correct from repro; good to land once JIT path is stable or skipped like other env builtins. |
Implement Zend putenv()/getenv() local environment table (php-src EG(env)): VmEnv tracks variables set via putenv(); getenv($name, $local_only=true) reads only that table. Fix putenv_/getenv_ to run side effects on FUNCCALL_EXEC_NORETURN (was a no-op when the return value was unused). AOT/JIT: __compiler_getenv(name, local_only, out), phpc_env_local.c, MCJIT StringEnvLocal bitcode link. php-src: ext/standard/basic_functions.c. Verification: vendor/bin/phpunit --filter getenv_local_only (VM + AOT green; JIT MCJIT -1 in Docker) php bin/compile.php -l test/repro-maintainer/getenv_local_only.php Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur
force-pushed
the
agent/stdlib-getenv-local-only
branch
from
May 30, 2026 12:33
de59db2 to
9f4f6d1
Compare
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
getenv(string $name, bool $local_only = false)per php-srczif_getenv/EG(env)—VmEnvtracksputenv()assignments;local_only=truereads only that table.putenv()/getenv()as statements: internal handlers no longer return early whenreturnVaris null (FUNCCALL_EXEC_NORETURN), which previously madeputenv('X=1');a no-op before a 2-arggetenv()call.phpc_env_local.c, extended__compiler_getenv(name, local_only, out),StringEnvLocalMCJIT bitcode link;putenvJIT registers local table via__compiler_env_register_putenv.php-src:
ext/standard/basic_functions.cTest plan
vendor/bin/phpunit --filter getenv_local_only— VMTest + AotTest greenphp bin/compile.php -l test/repro-maintainer/getenv_local_only.phpbin/jit.phpmay segfault on this host — follow-up if neededCloses #3710
Made with Cursor