From a4bdaeabf6d238ab4fc99134db0914cdbf58d584 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Tue, 11 Jul 2023 16:29:04 +0100 Subject: [PATCH] Fix bug GH-11600: Can't parse time strings which include (narrow) non-breaking space characters --- NEWS | 2 ++ ext/date/tests/bug-gh11600.phpt | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 ext/date/tests/bug-gh11600.phpt diff --git a/NEWS b/NEWS index b8a0448cc88..e1f69125b79 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,8 @@ PHP NEWS - Date: . Fixed bug GH-11368 (Date modify returns invalid datetime). (Derick) + . Fixed bug GH-11600 (Can't parse time strings which include (narrow) + non-breaking space characters). (Derick) - DOM: . Fixed bug GH-11625 (DOMElement::replaceWith() doesn't replace node with diff --git a/ext/date/tests/bug-gh11600.phpt b/ext/date/tests/bug-gh11600.phpt new file mode 100644 index 00000000000..29040a1686a --- /dev/null +++ b/ext/date/tests/bug-gh11600.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug GH-11600: Intl patterns are not parseable DateTime Strings +--INI-- +date.timezone=UTC +--FILE-- +getPattern(); + +$timeString = $formatter->format(strtotime('2023-07-11 16:02')); + +$timestamp = strtotime($timeString); + +var_dump($pattern, $timeString, $timestamp); +?> +--EXPECTF-- +string(8) "h:mm a" +string(9) "4:02 PM" +int(1689091320)