diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-25 03:20:08 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-25 03:33:09 +0900 |
| commit | c65cab710bb3d79db20862c9361d4dbbac8ac5d7 (patch) | |
| tree | b4d192237bbb8dbaa80166f1ffa24703e57243f4 /crates/shirabe/src/main.rs | |
| parent | f73e9ab05f8d94937d2437919199d9d9681c8cde (diff) | |
| download | php-shirabe-c65cab710bb3d79db20862c9361d4dbbac8ac5d7.tar.gz php-shirabe-c65cab710bb3d79db20862c9361d4dbbac8ac5d7.tar.zst php-shirabe-c65cab710bb3d79db20862c9361d4dbbac8ac5d7.zip | |
feat(php-shim): model $_ENV/$_SERVER as OsString snapshots
Rework the environment shim around getenv/putenv on the real environment
and $_ENV/$_SERVER as startup snapshots, all over OsString. Migrate every
caller off the old server()/server_argv() helpers and force the snapshots
in main() before any putenv() runs. Document the porting rules in
docs/dev/env-vars-porting.md.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/main.rs')
| -rw-r--r-- | crates/shirabe/src/main.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/shirabe/src/main.rs b/crates/shirabe/src/main.rs index 3e3623d..538d89d 100644 --- a/crates/shirabe/src/main.rs +++ b/crates/shirabe/src/main.rs @@ -1,8 +1,13 @@ //! ref: composer/bin/composer -use shirabe_php_shim::run_shutdown_functions; +use shirabe_php_shim::{PHP_ENV, PHP_SERVER, run_shutdown_functions}; fn main() { + // Take the $_ENV / $_SERVER snapshots before any putenv() mutates the real environment. + // See `docs/dev/env-vars-porting.md` for details. + std::sync::LazyLock::force(&PHP_ENV); + std::sync::LazyLock::force(&PHP_SERVER); + let result = shirabe::run(std::env::args().collect()); run_shutdown_functions(); let mut exit_code = match result { |
