summaryrefslogtreecommitdiff
path: root/framework/Collections
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Collections')
-rw-r--r--framework/Collections/TList.php4
-rw-r--r--framework/Collections/TMap.php4
-rw-r--r--framework/Collections/TPagedDataSource.php4
3 files changed, 7 insertions, 5 deletions
diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php
index b9fbd589..2946053b 100644
--- a/framework/Collections/TList.php
+++ b/framework/Collections/TList.php
@@ -246,7 +246,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess
foreach($data as $item)
$this->add($item);
}
- else
+ else if($data!==null)
throw new TInvalidDataTypeException('list_data_not_iterable');
}
@@ -263,7 +263,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess
foreach($data as $item)
$this->add($item);
}
- else
+ else if($data!==null)
throw new TInvalidDataTypeException('list_data_not_iterable');
}
diff --git a/framework/Collections/TMap.php b/framework/Collections/TMap.php
index 73665136..d5a44322 100644
--- a/framework/Collections/TMap.php
+++ b/framework/Collections/TMap.php
@@ -180,7 +180,7 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess
foreach($data as $key=>$value)
$this->add($key,$value);
}
- else
+ else if($data!==null)
throw new TInvalidDataTypeException('map_data_not_iterable');
}
@@ -197,7 +197,7 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess
foreach($data as $key=>$value)
$this->add($key,$value);
}
- else
+ else if($data!==null)
throw new TInvalidDataTypeException('map_data_not_iterable');
}
diff --git a/framework/Collections/TPagedDataSource.php b/framework/Collections/TPagedDataSource.php
index 5632e778..71e7c9e6 100644
--- a/framework/Collections/TPagedDataSource.php
+++ b/framework/Collections/TPagedDataSource.php
@@ -42,8 +42,10 @@ class TPagedDataSource extends TComponent implements IteratorAggregate
{
if(!($value instanceof TMap) && !($value instanceof TList))
{
- if(is_array($value) || ($value instanceof Traversable))
+ if(is_array($value))
$value=new TMap($value);
+ else if($value instanceof Traversable)
+ $value=new TList($value);
else if($value!==null)
throw new TInvalidDataTypeException('pageddatasource_datasource_invalid');
}