1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
From: William Desportes <williamdes@wdes.fr>
Date: Sun, 13 Apr 2025 15:15:59 +0200
Subject: Fix PHP 8.4 new IntlDateFormatter
8.4.0 A ValueError is thrown if locale is invalid.
Origin: vendor
Forwarded: no
---
src/Phing/Task/System/TstampTask.php | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/Phing/Task/System/TstampTask.php b/src/Phing/Task/System/TstampTask.php
index 4dc3cd5..8c1cb20 100644
--- a/src/Phing/Task/System/TstampTask.php
+++ b/src/Phing/Task/System/TstampTask.php
@@ -22,6 +22,7 @@ namespace Phing\Task\System;
use DateTime;
use Error;
+use ValueError;
use Exception;
use IntlDateFormatter;
use Phing\Exception\BuildException;
@@ -106,6 +107,9 @@ class TstampTask extends Task
} catch (Error $e) {
$value = "";
$this->log("Unable to format date (locale $locale) [{$e->getMessage()}]", Project::MSG_WARN);
+ } catch (ValueError $e) {
+ $value = "";
+ $this->log("Unable to create a date formatter (locale $locale) [{$e->getMessage()}]", Project::MSG_WARN);
}
$this->getProject()->setNewProperty($this->prefix . $propertyName, $value);
}
|