Skip to content

Stdlib: getenv() scalar name coercion without strict_types (#4177) - #20281

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-4177-getenv-putenv-coerce
Jul 17, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-4177-getenv-putenv-coerce

Conversation

@PurHur

@PurHur PurHur commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #4177

php-src reference

  • ext/standard/basic_functions.c — zif_getenv
  • Stub: getenv(?string $name = null, bool $local_only = false)

Verification

php bin/vm.php test/repro/issue_4177_getenv_putenv_coerce.php
# getenv int: 'one'
# getenv str: 'hello'
# putenv int: ok
# fread: x

./script/phpunit.sh --filter 'getenv_scalar_coerce|getenv_type_error|getenv_enum_case'
# OK (10 tests, 10 assertions)

Note: pre-existing AOT getenv_all / getenv_local_only fixture failures reproduce without this JIT change (zero-arg / string-literal paths).

Made with Cursor

Match php-src Z_PARAM_STR_OR_NULL: coerce int/float/bool when the caller
is not strict_types; keep TypeError under declare(strict_types=1) (#17765).

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 46d30cb into master Jul 17, 2026
@PurHur
PurHur deleted the agent/issue-4177-getenv-putenv-coerce branch July 19, 2026 01:55
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.

Stdlib: putenv()/fread() string params — scalar-to-string coercion (ext/standard/basic_functions.c parity)

1 participant