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) --- crates/shirabe-external-packages/src/symfony/console/terminal.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'crates/shirabe-external-packages/src/symfony/console/terminal.rs') diff --git a/crates/shirabe-external-packages/src/symfony/console/terminal.rs b/crates/shirabe-external-packages/src/symfony/console/terminal.rs index c02b87f..cc8f812 100644 --- a/crates/shirabe-external-packages/src/symfony/console/terminal.rs +++ b/crates/shirabe-external-packages/src/symfony/console/terminal.rs @@ -28,7 +28,8 @@ impl Terminal { let width = shirabe_php_shim::getenv("COLUMNS"); if let Some(width) = width { return shirabe_php_shim::intval(&PhpMixed::String(shirabe_php_shim::trim( - &width, None, + &width.to_string_lossy(), + None, ))); } @@ -44,7 +45,8 @@ impl Terminal { let height = shirabe_php_shim::getenv("LINES"); if let Some(height) = height { return shirabe_php_shim::intval(&PhpMixed::String(shirabe_php_shim::trim( - &height, None, + &height.to_string_lossy(), + None, ))); } @@ -85,7 +87,7 @@ impl Terminal { if let Some(ansicon) = &ansicon && shirabe_php_shim::preg_match( "/^(\\d+)x(\\d+)(?: \\((\\d+)x(\\d+)\\))?$/", - &shirabe_php_shim::trim(ansicon, None), + &shirabe_php_shim::trim(&ansicon.to_string_lossy(), None), &mut matches, ) { -- cgit v1.3.1