summaryrefslogtreecommitdiff
path: root/framework/TComponent.php
diff options
context:
space:
mode:
authorxue <>2005-11-17 20:44:03 +0000
committerxue <>2005-11-17 20:44:03 +0000
commit5f88fccb2aa110929880085152e962f3c1769520 (patch)
tree96326432dd498c27a72ad6dfca12b864415332c9 /framework/TComponent.php
parentd833d2766f28f927cb4e1e8e660771361abdfdf9 (diff)
Fixed a problem with converting a string to an array.
Diffstat (limited to 'framework/TComponent.php')
-rw-r--r--framework/TComponent.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/framework/TComponent.php b/framework/TComponent.php
index 04c99f2a..b91afb2d 100644
--- a/framework/TComponent.php
+++ b/framework/TComponent.php
@@ -500,19 +500,20 @@ class TPropertyValue
*/
public static function ensureArray($value)
{
- if (is_string($value)) {
+ if(is_string($value))
+ {
$trimmed = trim($value);
$len = strlen($value);
- if ($len >= 2 && $trimmed{0} == '(' && $trimmed{$len-1} == ')') {
- return explode(",", substr($trimmed,1,$len-2));
- } else if ($len > 0) {
- return array($value);
- } else {
- return array();
+ if ($len >= 2 && $trimmed[0] == '(' && $trimmed[$len-1] == ')')
+ {
+ eval('$array=array'.$trimmed.';');
+ return $array;
}
- } else {
+ else
+ return $len>0?array($value):array();
+ }
+ else
return (array)$value;
- }
}
/**
@@ -527,6 +528,7 @@ class TPropertyValue
/**
* Converts a value to enum type.
+ * Note, enumeration values are case-sensitive strings.
* @param mixed the value to be converted.
* @param array array of strings representing the enum type.
* @return string