Ref #17418 - Fix #16746 - Remove the use of deprecated strftime in OpenDocument exports

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2022-03-05 23:38:59 +01:00
parent 639175db9e
commit a4417e07df
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -7,7 +7,8 @@ declare(strict_types=1);
namespace PhpMyAdmin;
use function strftime;
use DateTime;
use const DATE_W3C;
/**
* Simplified OpenDocument creator class
@ -35,6 +36,9 @@ EOT;
*/
public static function create($mime, $data)
{
// Use the same date method as other PHP libs
// https://github.com/PHPOffice/PhpSpreadsheet/blob/1.22.0/src/PhpSpreadsheet/Writer/Ods/Meta.php#L49
$dateTimeCreation = (new DateTime())->format(DATE_W3C);
$data = [
$mime,
$data,
@ -47,7 +51,7 @@ EOT;
. '<meta:generator>phpMyAdmin ' . PMA_VERSION . '</meta:generator>'
. '<meta:initial-creator>phpMyAdmin ' . PMA_VERSION
. '</meta:initial-creator>'
. '<meta:creation-date>' . @strftime('%Y-%m-%dT%H:%M:%S')
. '<meta:creation-date>' . $dateTimeCreation
. '</meta:creation-date>'
. '</office:meta>'
. '</office:document-meta>',