From d4429546e20ec23787d42583f955c3c1ad8d5bbe Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 12 Dec 2013 16:23:19 +0100 Subject: [PATCH] DibiRow: null time checking consistent with DibiResult Conflicts: dibi/libs/DibiRow.php --- dibi/libs/DibiRow.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dibi/libs/DibiRow.php b/dibi/libs/DibiRow.php index 9a913248..194e6ed8 100644 --- a/dibi/libs/DibiRow.php +++ b/dibi/libs/DibiRow.php @@ -39,7 +39,7 @@ class DibiRow implements ArrayAccess, IteratorAggregate, Countable { $time = $this[$key]; if (!$time instanceof DibiDateTime) { - if ((int) $time === 0) { // '', NULL, FALSE, '0000-00-00', ... + if ((int) $time === 0 && substr((string) $time, 0, 3) !== '00:') { // '', NULL, FALSE, '0000-00-00', ... return NULL; } $time = new DibiDateTime(is_numeric($time) ? date('Y-m-d H:i:s', $time) : $time); @@ -56,10 +56,7 @@ class DibiRow implements ArrayAccess, IteratorAggregate, Countable public function asTimestamp($key) { trigger_error(__METHOD__ . '() is deprecated.', E_USER_WARNING); - $time = $this[$key]; - return (int) $time === 0 // '', NULL, FALSE, '0000-00-00', ... - ? NULL - : (is_numeric($time) ? (int) $time : strtotime($time)); + return $this->asDateTime($key, 'U'); }