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

DibiTranslator: fixed bug in DateTime object usage

This commit is contained in:
David Grudl 2009-08-26 00:09:05 +02:00
parent 217de42d20
commit 08e70fda61

View File

@ -329,10 +329,7 @@ final class DibiTranslator extends DibiObject
if ($value instanceof IDibiVariable) {
return $value->toSql($this, $modifier);
} elseif ($value instanceof DateTime) {
$value = $value->format('U');
} elseif ($value !== NULL && !is_scalar($value)) { // array is already processed
} elseif ($value !== NULL && !is_scalar($value) && !($value instanceof DateTime)) { // array is already processed
$this->hasError = TRUE;
return '**Unexpected type ' . gettype($value) . '**';
}
@ -436,7 +433,7 @@ final class DibiTranslator extends DibiObject
return $value->toSql($this, NULL);
if ($value instanceof DateTime)
return $value = $value->format('U');
return $this->driver->escape($value, dibi::DATETIME);
$this->hasError = TRUE;
return '**Unexpected ' . gettype($value) . '**';