[php-src] Issue #11392: date_parse of time with fraction followed by meridian handled incorrectly
| From: | lucasnetau | Date: | Wed, 07 Jun 2023 12:19:34 +0000 |
| Subject: | [php-src] Issue #11392: date_parse of time with fraction followed by meridian handled incorrectly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244617@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11392
Author: lucasnetau
### Description
When a time string included both a fraction and meridian date_parse (and DateTime classes) parse the
meridian as a timezone (timeformat timelong12 does not appear to have fraction support). The same
date string with fractions is parsed correctly
```php
<?php
print_r(date_parse('10/05/2023 10:57:00.000 PM'));
```
Resulted in this output:
```php
Array
(
[year] => 2023
[month] => 10
[day] => 5
[hour] => 10
[minute] => 57
[second] => 0
[fraction] => 0
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 1
[errors] => Array
(
[22] => The timezone could not be found in the database
)
[is_localtime] => 1
[zone_type] => 0
)
```
But I expected this output instead:
```php
Array
(
[year] => 2023
[month] => 10
[day] => 5
[hour] => 22
[minute] => 57
[second] => 0
[fraction] => 0
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 0
[errors] => Array
(
)
[is_localtime] =>
)
```
### PHP Version
PHP 8.2
### Operating System
_No response_