diff options
author | xue <> | 2005-11-12 11:43:41 +0000 |
---|---|---|
committer | xue <> | 2005-11-12 11:43:41 +0000 |
commit | 63386d118321bbff8af2d8c480b89fe226400d53 (patch) | |
tree | b3512c1d832383df7234035e35891eddf11bb469 /framework/TComponent.php | |
parent | aaa53c4df4aff631c92ef6ac359693928444ab26 (diff) |
Changed how string is converted to boolean.
Diffstat (limited to 'framework/TComponent.php')
-rw-r--r-- | framework/TComponent.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/framework/TComponent.php b/framework/TComponent.php index cdf83016..a23204d5 100644 --- a/framework/TComponent.php +++ b/framework/TComponent.php @@ -437,13 +437,14 @@ class TPropertyValue * Converts a value to boolean type.
* Note, string 'true' (case-insensitive) will be converted to true,
* string 'false' (case-insensitive) will be converted to false.
+ * If a string represents a non-zero number, it will be treated as true.
* @param mixed the value to be converted.
* @return boolean
*/
public static function ensureBoolean($value)
{
if (is_string($value))
- return strcasecmp($value,'true')==0;
+ return strcasecmp($value,'true')==0 || $value!=0;
else
return (boolean)$value;
}
|