From 85cd5adaf18e990ae39e5506886788f58eb0bce5 Mon Sep 17 00:00:00 2001 From: DarkAngelBGE Date: Mon, 5 May 2008 15:04:02 +0000 Subject: [PATCH] changing numeric check in TimeHelper::wasWithinLast to remove the use of a php extension git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6761 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/view/helpers/time.php | 2 +- cake/tests/cases/libs/view/helpers/time.test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cake/libs/view/helpers/time.php b/cake/libs/view/helpers/time.php index 0a7101643..6700a9df5 100644 --- a/cake/libs/view/helpers/time.php +++ b/cake/libs/view/helpers/time.php @@ -431,7 +431,7 @@ class TimeHelper extends AppHelper { */ function wasWithinLast($timeInterval, $date_string) { $tmp = r(' ', '', $timeInterval); - if (is_int($tmp) || preg_match('/[\d]+/', $tmp)) { + if (is_numeric($tmp)) { $timeInterval = $tmp.' days'; } diff --git a/cake/tests/cases/libs/view/helpers/time.test.php b/cake/tests/cases/libs/view/helpers/time.test.php index 8e0974136..4cc54add4 100644 --- a/cake/tests/cases/libs/view/helpers/time.test.php +++ b/cake/tests/cases/libs/view/helpers/time.test.php @@ -501,7 +501,7 @@ class TimeTest extends UnitTestCase { $this->assertTrue($this->Time->wasWithinLast('5 ', '-3 days')); $this->assertTrue($this->Time->wasWithinLast('1 ', '-1 hour')); $this->assertTrue($this->Time->wasWithinLast('1 ', '-1 minute')); - $this->assertTrue($this->Time->wasWithinLast('1 ', '-23 hours -59 minutes - 59 seconds')); + $this->assertTrue($this->Time->wasWithinLast('1 ', '-23 hours -59 minutes -59 seconds')); } function tearDown() {