Fix deprecated DateTimeInterface::RFC7231 constant for PHP 8.5

Replace the deprecated DateTimeInterface::RFC7231 constant with its
equivalent format string 'D, d M Y H:i:s \G\M\T' to avoid deprecation
warnings on PHP 8.5.

Fixes #20037

Signed-off-by: moaead <165377585+moaead@users.noreply.github.com>
Signed-off-by: Moaead Yahya <moaead@gmail.com>
This commit is contained in:
Moaead Yahya 2026-01-21 07:50:58 +00:00 committed by Maurício Meneghini Fauth
parent 3b961d3c84
commit ceb905f70c
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace PhpMyAdmin;
use DateTimeInterface;
use DateTimeZone;
use PhpMyAdmin\Clock\Clock;
use PhpMyAdmin\Error\ErrorHandler;
@ -232,7 +231,7 @@ class Core
public static function getNoCacheHeaders(ClockInterface $clock): array
{
$headers = [];
$formattedDateTime = $clock->now()->setTimezone(new DateTimeZone('UTC'))->format(DateTimeInterface::RFC7231);
$formattedDateTime = $clock->now()->setTimezone(new DateTimeZone('UTC'))->format('D, d M Y H:i:s \G\M\T');
// rfc2616 - Section 14.21
$headers['Expires'] = $formattedDateTime;