Skip to content

Commit 59274ba

Browse files
authored
[php] Update date for headers (#9731)
1 parent b60e904 commit 59274ba

File tree

12 files changed

+27
-27
lines changed

12 files changed

+27
-27
lines changed

frameworks/PHP/cakephp/server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class HeaderDate
3636

3737
public static function init(): void
3838
{
39-
self::$date = self::NAME.gmdate('D, d M Y H:i:s').' GMT';
39+
self::$date = self::NAME.gmdate(DATE_RFC7231);
4040
Timer::add(1, static function () {
41-
self::$date = self::NAME.gmdate('D, d M Y H:i:s').' GMT';
41+
self::$date = self::NAME.gmdate(DATE_RFC7231);
4242
});
4343
}
4444
}

frameworks/PHP/comet/app.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
$app->init(
2525
function() {
2626
ORM::init();
27-
Storage::$date = gmdate('D, d M Y H:i:s').' GMT';
27+
Storage::$date = gmdate(DATE_RFC7231);
2828
Timer::add(1, function() {
29-
Storage::$date = gmdate('D, d M Y H:i:s').' GMT';
29+
Storage::$date = gmdate(DATE_RFC7231);
3030
});
3131
});
3232

frameworks/PHP/cyberphp/src/Response.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public static function json(mixed $data, int $status = 200, array $headers = [])
127127
}
128128

129129
$headers['Content-Type'] = 'application/json; charset=utf-8';
130-
$headers['Date'] = gmdate('D, d M Y H:i:s').' GMT';
130+
$headers['Date'] = gmdate(DATE_RFC7231);
131131
return new static($json, $status, $headers);
132132
}
133133

@@ -137,7 +137,7 @@ public static function json(mixed $data, int $status = 200, array $headers = [])
137137
public static function html(string $html, int $status = 200, array $headers = []): static
138138
{
139139
$headers['Content-Type'] = 'text/html; charset=utf-8';
140-
$headers['Date'] = gmdate('D, d M Y H:i:s').' GMT';
140+
$headers['Date'] = gmdate(DATE_RFC7231);
141141
return new static($html, $status, $headers);
142142
}
143143

@@ -147,7 +147,7 @@ public static function html(string $html, int $status = 200, array $headers = []
147147
public static function text(string $text, int $status = 200, array $headers = []): static
148148
{
149149
$headers['Content-Type'] = 'text/plain; charset=utf-8';
150-
$headers['Date'] = gmdate('D, d M Y H:i:s').' GMT';
150+
$headers['Date'] = gmdate(DATE_RFC7231);
151151
return new static($text, $status, $headers);
152152
}
153153
/**
@@ -156,7 +156,7 @@ public static function text(string $text, int $status = 200, array $headers = []
156156
public static function file(string $file, string $filename, int $status = 200, array $headers = []): static
157157
{
158158
$headers['Content-Type'] = 'application/octet-stream';
159-
$headers['Date'] = gmdate('D, d M Y H:i:s').' GMT';
159+
$headers['Date'] = gmdate(DATE_RFC7231);
160160
$headers['Content-Disposition'] = 'attachment; filename="' . $filename . '"';
161161
return new static(file_get_contents($file), $status, $headers);
162162
}

frameworks/PHP/imi/Listener/WorkermanWorkerStart.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class WorkermanWorkerStart implements IEventListener
1919
*/
2020
public function handle(EventParam $e): void
2121
{
22-
App::set('test_date', gmdate('D, d M Y H:i:s').' GMT');
22+
App::set('test_date', gmdate(DATE_RFC7231));
2323
Timer::tick(1000, function() {
24-
App::set('test_date', gmdate('D, d M Y H:i:s').' GMT');
24+
App::set('test_date', gmdate(DATE_RFC7231));
2525
});
2626
}
2727

frameworks/PHP/laravel/server-man.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
$http_worker->count = (int) shell_exec('nproc') * 4;
1313
$http_worker->name = 'AdapterMan-Laravel';
1414
$http_worker->onWorkerStart = static function () {
15-
Header::$date = gmdate('D, d M Y H:i:s').' GMT';
15+
Header::$date = gmdate(DATE_RFC7231);
1616
Timer::add(1, function() {
17-
Header::$date = gmdate('D, d M Y H:i:s').' GMT';
17+
Header::$date = gmdate(DATE_RFC7231);
1818
});
1919
//init();
2020
require __DIR__.'/start.php';

frameworks/PHP/leaf/server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class HeaderDate
3838

3939
public static function init(): void
4040
{
41-
self::$date = self::NAME . gmdate('D, d M Y H:i:s').' GMT';
41+
self::$date = self::NAME . gmdate(DATE_RFC7231);
4242
Timer::add(1, static function() {
43-
self::$date = self::NAME . gmdate('D, d M Y H:i:s').' GMT';
43+
self::$date = self::NAME . gmdate(DATE_RFC7231);
4444
});
4545
}
4646
}

frameworks/PHP/mark/start.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
], \json_encode(['message' => 'Hello, World!']));
2828
});
2929

30-
$date = gmdate('D, d M Y H:i:s').' GMT';
30+
$date = gmdate(DATE_RFC7231);
3131

3232
$api->onWorkerStart = static function () {
3333
Timer::add(1, function () {
3434
global $date;
35-
$date = gmdate('D, d M Y H:i:s').' GMT';
35+
$date = gmdate(DATE_RFC7231);
3636
});
3737
};
3838

frameworks/PHP/slim/server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class HeaderDate
3838

3939
public static function init(): void
4040
{
41-
self::$date = self::NAME . gmdate('D, d M Y H:i:s').' GMT';
41+
self::$date = self::NAME . gmdate(DATE_RFC7231);
4242
Timer::add(1, static function() {
43-
self::$date = self::NAME . gmdate('D, d M Y H:i:s').' GMT';
43+
self::$date = self::NAME . gmdate(DATE_RFC7231);
4444
});
4545
}
4646
}

frameworks/PHP/symfony/server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
$http_worker->name = 'AdapterMan-Symfony';
1414

1515
$http_worker->onWorkerStart = static function () {
16-
Header::$date = gmdate('D, d M Y H:i:s').' GMT';
16+
Header::$date = gmdate(DATE_RFC7231);
1717
Timer::add(1, function() {
18-
Header::$date = gmdate('D, d M Y H:i:s').' GMT';
18+
Header::$date = gmdate(DATE_RFC7231);
1919
});
2020
//init();
2121
require __DIR__.'/start.php';

frameworks/PHP/webman/support/bootstrap/Date.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class Date implements Bootstrap {
3030
*/
3131
public static function start($worker)
3232
{
33-
self::$date = gmdate('D, d M Y H:i:s').' GMT';
33+
self::$date = gmdate(DATE_RFC7231);
3434
Timer::add(1, function() {
35-
self::$date = gmdate('D, d M Y H:i:s').' GMT';
35+
self::$date = gmdate(DATE_RFC7231);
3636
});
3737
}
3838

0 commit comments

Comments
 (0)