mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Forward port fixes for #4294 from 1.3 to 2.x
CakeTime was broken in the same way as TimeHelper was in 1.x. Getting 1969 on invalid input can be very confusing and un-helpful. Refs #4294
This commit is contained in:
parent
07937d5a5f
commit
0400a63004
2 changed files with 9 additions and 0 deletions
|
@ -597,6 +597,12 @@ class CakeTimeTest extends CakeTestCase {
|
|||
$result = $this->Time->format('Y-m-d', null, 'never');
|
||||
$this->assertEquals('never', $result);
|
||||
|
||||
$result = $this->Time->format('Y-m-d', '');
|
||||
$this->assertSame('', $result);
|
||||
|
||||
$result = $this->Time->format('Y-m-d', false);
|
||||
$this->assertSame('', $result);
|
||||
|
||||
$result = $this->Time->format('2012-01-13', '%d-%m-%Y', 'invalid');
|
||||
$this->assertEquals('13-01-2012', $result);
|
||||
|
||||
|
|
|
@ -1053,6 +1053,9 @@ class CakeTime {
|
|||
if ($date === false && $default !== false) {
|
||||
return $default;
|
||||
}
|
||||
if ($date === false) {
|
||||
return '';
|
||||
}
|
||||
if (empty($format)) {
|
||||
$format = '%x';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue