From 279aa3bb883563d26ce316563ee3ef083f9905da Mon Sep 17 00:00:00 2001 From: jrags <> Date: Sun, 31 Dec 2006 03:08:25 +0000 Subject: Added more boolean support in TPropertyValue::ensureBoolean, it now supports the following: (string) 'true' == (bool) true,(string) '1' == (bool) true,(int) 1 == (bool) true,(bool) true == (bool) true, (string) 'false' == (bool) false,(string) '0' == (bool) false,(int) 0 == (bool) false,(bool) false == (bool) false --- framework/TComponent.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'framework/TComponent.php') diff --git a/framework/TComponent.php b/framework/TComponent.php index 54fe7ec7..9af42a9a 100644 --- a/framework/TComponent.php +++ b/framework/TComponent.php @@ -515,7 +515,9 @@ class TPropertyValue public static function ensureBoolean($value) { if (is_string($value)) - return strcasecmp($value,'true')==0 || $value!=0; + return strcasecmp($value,'true')==0 || strcasecmp($value,'1')==0 || $value!=0; + if (is_int($value)) + return $value === 1; else return (boolean)$value; } -- cgit v1.2.3