From a2110fa811c8f6c7d1c45a83c6fd1077eb6f3461 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 20 Jul 2026 16:51:45 +0900 Subject: fix(php-shim): use PhpMixed::to_bool() for PHP truthy casts Several call sites coerced PhpMixed to bool via `.as_bool()` (which only matches a literal Bool variant) where the corresponding PHP code does a plain `(bool)` cast or truthy check (isset()/array_key_exists() + implicit bool conversion). This silently dropped truthy non-bool values (e.g. String("true"), String("1"), Int(1)) to their unwrap_or default instead of PHP's actual truthy result. Switched these sites to PhpMixed::to_bool(), which implements PHP's full truthy-cast rules. --- crates/shirabe/src/util/remote_filesystem.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/shirabe/src/util/remote_filesystem.rs') diff --git a/crates/shirabe/src/util/remote_filesystem.rs b/crates/shirabe/src/util/remote_filesystem.rs index 08e8581f..103a94a7 100644 --- a/crates/shirabe/src/util/remote_filesystem.rs +++ b/crates/shirabe/src/util/remote_filesystem.rs @@ -194,8 +194,12 @@ impl RemoteFilesystem { self.redirects = 1; // The first request counts. let mut temp_additional_options = additional_options.clone(); - if let Some(v) = temp_additional_options.get("retry-auth-failure").cloned() { - retry_auth_failure = v.as_bool().unwrap_or(true); + if let Some(v) = temp_additional_options + .get("retry-auth-failure") + .and_then(|v| v.as_opt()) + .cloned() + { + retry_auth_failure = v.to_bool(); temp_additional_options.shift_remove("retry-auth-failure"); } -- cgit v1.3.1