mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
Fix DateTime constructor calls with null
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
bc3acfc957
commit
3a1b3745eb
3 changed files with 5 additions and 5 deletions
|
|
@ -46,7 +46,7 @@ abstract class LogDetails {
|
|||
}
|
||||
$time = \DateTime::createFromFormat("U.u", number_format(microtime(true), 4, ".", ""));
|
||||
if ($time === false) {
|
||||
$time = new \DateTime(null, $timezone);
|
||||
$time = new \DateTime('now', $timezone);
|
||||
} else {
|
||||
// apply timezone if $time is created from UNIX timestamp
|
||||
$time->setTimezone($timezone);
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ class DispatcherTest extends \Test\TestCase {
|
|||
|
||||
$this->response = $this->createMock(Response::class);
|
||||
|
||||
$this->lastModified = new \DateTime(null, new \DateTimeZone('GMT'));
|
||||
$this->lastModified = new \DateTime('now', new \DateTimeZone('GMT'));
|
||||
$this->etag = 'hi';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ class ResponseTest extends \Test\TestCase {
|
|||
|
||||
|
||||
public function testGetLastModified() {
|
||||
$lastModified = new \DateTime(null, new \DateTimeZone('GMT'));
|
||||
$lastModified = new \DateTime('now', new \DateTimeZone('GMT'));
|
||||
$lastModified->setTimestamp(1);
|
||||
$this->childResponse->setLastModified($lastModified);
|
||||
$this->assertEquals($lastModified, $this->childResponse->getLastModified());
|
||||
|
|
@ -252,7 +252,7 @@ class ResponseTest extends \Test\TestCase {
|
|||
|
||||
|
||||
public function testEtagLastModifiedHeaders() {
|
||||
$lastModified = new \DateTime(null, new \DateTimeZone('GMT'));
|
||||
$lastModified = new \DateTime('now', new \DateTimeZone('GMT'));
|
||||
$lastModified->setTimestamp(1);
|
||||
$this->childResponse->setLastModified($lastModified);
|
||||
$headers = $this->childResponse->getHeaders();
|
||||
|
|
@ -260,7 +260,7 @@ class ResponseTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testChainability() {
|
||||
$lastModified = new \DateTime(null, new \DateTimeZone('GMT'));
|
||||
$lastModified = new \DateTime('now', new \DateTimeZone('GMT'));
|
||||
$lastModified->setTimestamp(1);
|
||||
|
||||
$this->childResponse->setEtag('hi')
|
||||
|
|
|
|||
Loading…
Reference in a new issue