From c65cab710bb3d79db20862c9361d4dbbac8ac5d7 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 25 Jun 2026 03:20:08 +0900 Subject: 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) --- .../console/command/dump_completion_command.rs | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs') diff --git a/crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs b/crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs index 306bd59..588b868 100644 --- a/crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs +++ b/crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs @@ -73,7 +73,14 @@ impl DumpCompletionCommand { } fn guess_shell() -> String { - shirabe_php_shim::basename(&shirabe_php_shim::server_shell().unwrap_or_default()) + shirabe_php_shim::basename( + &shirabe_php_shim::PHP_SERVER + .lock() + .unwrap() + .get("SHELL") + .unwrap_or_default() + .to_string_lossy(), + ) } fn tail_debug_log(&self, command_name: &str, _output: &dyn OutputInterface) { @@ -112,7 +119,13 @@ impl DumpCompletionCommand { impl Command for DumpCompletionCommand { fn configure(&self) -> anyhow::Result<()> { - let full_command = shirabe_php_shim::server_php_self(); + let full_command = shirabe_php_shim::PHP_SERVER + .lock() + .unwrap() + .php_self() + .unwrap_or_default() + .to_string_lossy() + .into_owned(); let command_name = shirabe_php_shim::basename(&full_command); // @realpath($fullCommand) ?: $fullCommand let full_command = match shirabe_php_shim::realpath(&full_command) { @@ -170,7 +183,15 @@ impl Command for DumpCompletionCommand { input: Rc>, output: Rc>, ) -> anyhow::Result { - let command_name = shirabe_php_shim::basename(&shirabe_php_shim::server_argv()[0]); + let command_name = shirabe_php_shim::basename( + &shirabe_php_shim::PHP_SERVER + .lock() + .unwrap() + .argv() + .next() + .unwrap_or_default() + .to_string_lossy(), + ); if input.borrow().get_option("debug")?.to_bool() { self.tail_debug_log(&command_name, &*output.borrow()); -- cgit v1.3.1