Skip to content

Commit a4bdaea

Browse files
committedJul 11, 2023
Fix bug GH-11600: Can't parse time strings which include (narrow) non-breaking space characters
1 parent b8fe445 commit a4bdaea

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
 

‎NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ PHP NEWS
2121

2222
- Date:
2323
. Fixed bug GH-11368 (Date modify returns invalid datetime). (Derick)
24+
. Fixed bug GH-11600 (Can't parse time strings which include (narrow)
25+
non-breaking space characters). (Derick)
2426

2527
- DOM:
2628
. Fixed bug GH-11625 (DOMElement::replaceWith() doesn't replace node with

‎ext/date/tests/bug-gh11600.phpt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Bug GH-11600: Intl patterns are not parseable DateTime Strings
3+
--INI--
4+
date.timezone=UTC
5+
--FILE--
6+
<?php
7+
$formatter = new IntlDateFormatter('en_US', -1, 3);
8+
$pattern = $formatter->getPattern();
9+
10+
$timeString = $formatter->format(strtotime('2023-07-11 16:02'));
11+
12+
$timestamp = strtotime($timeString);
13+
14+
var_dump($pattern, $timeString, $timestamp);
15+
?>
16+
--EXPECTF--
17+
string(8) "h:mm a"
18+
string(9) "4:02 PM"
19+
int(1689091320)

0 commit comments

Comments
 (0)