1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-21 05:11:49 +02:00

- DibiResult: meta type Dibi::FIELD_BOOL resolves 'f' and 'F' as FALSE

This commit is contained in:
David Grudl
2008-01-02 05:25:21 +00:00
parent 041f059408
commit de4a882788
23 changed files with 80 additions and 76 deletions

View File

@@ -4,14 +4,14 @@
* dibi - tiny'n'smart database abstraction layer
* ----------------------------------------------
*
* Copyright (c) 2005, 2007 David Grudl aka -dgx- (http://www.dgx.cz)
* Copyright (c) 2005, 2008 David Grudl aka -dgx- (http://www.dgx.cz)
*
* This source file is subject to the "dibi license" that is bundled
* with this package in the file license.txt.
*
* For more information please see http://dibiphp.com/
*
* @copyright Copyright (c) 2005, 2007 David Grudl
* @copyright Copyright (c) 2005, 2008 David Grudl
* @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com/
* @package dibi
@@ -36,7 +36,7 @@
* </code>
*
* @author David Grudl
* @copyright Copyright (c) 2005, 2007 David Grudl
* @copyright Copyright (c) 2005, 2008 David Grudl
* @package dibi
* @version $Revision$ $Date$
*/
@@ -78,7 +78,6 @@ class DibiResult extends NObject implements IteratorAggregate, Countable
private static $types = array(
dibi::FIELD_TEXT => 'string',
dibi::FIELD_BINARY => 'string',
dibi::FIELD_BOOL => 'bool',
dibi::FIELD_INTEGER => 'int',
dibi::FIELD_FLOAT => 'float',
dibi::FIELD_COUNTER => 'int',
@@ -462,7 +461,11 @@ class DibiResult extends NObject implements IteratorAggregate, Countable
}
if ($type === dibi::FIELD_DATE || $type === dibi::FIELD_DATETIME) {
return strtotime($value); // !!! not good
return strtotime($value);
}
if ($type === dibi::FIELD_BOOL) {
return ((bool) $value) && $value !== 'f' && $value !== 'F';
}
return $value;