summaryrefslogtreecommitdiff
path: root/framework/TComponent.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/TComponent.php')
-rw-r--r--framework/TComponent.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/framework/TComponent.php b/framework/TComponent.php
index 8df1f235..04c99f2a 100644
--- a/framework/TComponent.php
+++ b/framework/TComponent.php
@@ -490,13 +490,29 @@ class TPropertyValue
}
/**
- * Converts a value to array type.
+ * Converts a value to array type. If the value is a string and it is
+ * in the form (a,b,c) then an array consisting of each of the elements
+ * will be returned. If the value is a string and it is not in this form
+ * then an array consisting of just the string will be returned. If the value
+ * is not a string then
* @param mixed the value to be converted.
* @return array
*/
public static function ensureArray($value)
{
- return (array)$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();
+ }
+ } else {
+ return (array)$value;
+ }
}
/**