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() {