From 3ad074e9410153fefaa2343165a68a355400fd6e Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 21 Apr 2006 12:58:38 +0000 Subject: removed exceptions from simple date formatter --- framework/Util/TSimpleDateFormatter.php | 12 ++++++++---- tests/FunctionalTests/PradoTester.php | 2 +- tests/FunctionalTests/features/protected/controls/Layout.tpl | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/framework/Util/TSimpleDateFormatter.php b/framework/Util/TSimpleDateFormatter.php index 7be49bc9..052e0074 100644 --- a/framework/Util/TSimpleDateFormatter.php +++ b/framework/Util/TSimpleDateFormatter.php @@ -246,7 +246,8 @@ class TSimpleDateFormatter if ($token=='y') { $x=2;$y=4; } $year = $this->getInteger($value,$i_val,$x,$y); if(is_null($year)) - throw new TInvalidDataValueException('Invalid year', $value); + return null; + //throw new TInvalidDataValueException('Invalid year', $value); $i_val += strlen($year); if(strlen($year) == 2) { @@ -264,7 +265,8 @@ class TSimpleDateFormatter $this->length($token),2); $iMonth = intval($month); if(is_null($month) || $iMonth < 1 || $iMonth > 12 ) - throw new TInvalidDataValueException('Invalid month', $value); + return null; + //throw new TInvalidDataValueException('Invalid month', $value); $i_val += strlen($month); $month = $iMonth; } @@ -274,14 +276,16 @@ class TSimpleDateFormatter $this->length($token), 2); $iDay = intval($day); if(is_null($day) || $iDay < 1 || $iDay >31) - throw new TInvalidDataValueException('Invalid day', $value); + return null; + //throw new TInvalidDataValueException('Invalid day', $value); $i_val += strlen($day); $day = $iDay; } else { if($this->substring($value, $i_val, $this->length($token)) != $token) - throw new TInvalidDataValueException("Subpattern '{$this->pattern}' mismatch", $value); + return null; + //throw new TInvalidDataValueException("Subpattern '{$this->pattern}' mismatch", $value); else $i_val += $this->length($token); } diff --git a/tests/FunctionalTests/PradoTester.php b/tests/FunctionalTests/PradoTester.php index 8d081e0f..0c83217e 100644 --- a/tests/FunctionalTests/PradoTester.php +++ b/tests/FunctionalTests/PradoTester.php @@ -42,7 +42,7 @@ class PradoTester else if($entry[0]!=='.') $this->collectTestFiles($groupTest,$fullPath); } - closedir($folder); + @closedir($folder); } protected function isValidFile($entry) diff --git a/tests/FunctionalTests/features/protected/controls/Layout.tpl b/tests/FunctionalTests/features/protected/controls/Layout.tpl index 18482377..d1b33d94 100644 --- a/tests/FunctionalTests/features/protected/controls/Layout.tpl +++ b/tests/FunctionalTests/features/protected/controls/Layout.tpl @@ -22,6 +22,7 @@