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/package/complete_package.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'crates/shirabe/src/package/complete_package.rs') diff --git a/crates/shirabe/src/package/complete_package.rs b/crates/shirabe/src/package/complete_package.rs index ec9986c9..b2c3978c 100644 --- a/crates/shirabe/src/package/complete_package.rs +++ b/crates/shirabe/src/package/complete_package.rs @@ -127,11 +127,7 @@ impl CompletePackageInterface for CompletePackage { } fn is_abandoned(&self) -> bool { - match &self.abandoned { - PhpMixed::Bool(b) => *b, - PhpMixed::String(s) => !s.is_empty(), - _ => false, - } + self.abandoned.to_bool() } fn set_abandoned(&mut self, abandoned: PhpMixed) { -- cgit v1.3.1