1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-24 10:53:17 +01:00

changed empty-date detection

This commit is contained in:
David Grudl 2009-11-16 01:54:27 +01:00
parent 5e7774404b
commit 8586eb8e29
2 changed files with 2 additions and 2 deletions

View File

@ -624,7 +624,7 @@ class DibiResult extends DibiObject implements IDataSource
case dibi::DATE: case dibi::DATE:
case dibi::DATETIME: case dibi::DATETIME:
if ($value == NULL) { // intentionally == if ((int) $value === 0) { // '', NULL, FALSE, '0000-00-00', ...
return NULL; return NULL;
} elseif ($format === NULL) { // return timestamp (default) } elseif ($format === NULL) { // return timestamp (default)

View File

@ -48,7 +48,7 @@ class DibiRow extends ArrayObject
public function asDate($key, $format = NULL) public function asDate($key, $format = NULL)
{ {
$time = $this[$key]; $time = $this[$key];
if ($time == NULL) { // intentionally == if ((int) $time === 0) { // '', NULL, FALSE, '0000-00-00', ...
return NULL; return NULL;
} elseif ($format === NULL) { // return timestamp (default) } elseif ($format === NULL) { // return timestamp (default)