From 064a9019b04dfbf452548df129a515cbf1b2a67f Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Sun, 14 Dec 2008 22:35:37 +0000 Subject: [PATCH] BUGFIX: Make sure date is a string before trying to use strtotime git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@68834 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/fieldtypes/Date.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/model/fieldtypes/Date.php b/core/model/fieldtypes/Date.php index ac1fb6903..41be21283 100644 --- a/core/model/fieldtypes/Date.php +++ b/core/model/fieldtypes/Date.php @@ -16,7 +16,7 @@ class Date extends DBField { if(ereg('^([0-9]+)/([0-9]+)/([0-9]+)$', $value, $parts)) $value = "$parts[2]/$parts[1]/$parts[3]"; - if($value) $this->value = date('Y-m-d', strtotime($value)); + if($value && is_string($value)) $this->value = date('Y-m-d', strtotime($value)); else $value = null; } @@ -258,4 +258,4 @@ class Date extends DBField { } } -?> \ No newline at end of file +?>