php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77733 IntlDateFormatter parsing incorrectly
Submitted: 2019-03-13 09:00 UTC Modified: 2019-03-13 09:49 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: shariefjamiel at gmail dot com Assigned:
Status: Open Package: Date/time related
PHP Version: 7.2.16 OS: ubuntu 18.04 - php 7.2.15
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: shariefjamiel at gmail dot com
New email:
PHP Version: OS:

 

 [2019-03-13 09:00 UTC] shariefjamiel at gmail dot com
Description:
------------
---
From manual page: https://php.net/intldateformatter.parse
---
Passing a totally wrong datetime format returns a valid but strange datetime despite the date formats being so different.

e.g. 2019-12-10 10:10:00 becomes 2016-06-10 09:10:00

If the date format is wrong to start with, should it not return null?

Test script:
---------------
use IntlDateFormatter;
$formatter = new IntlDateFormatter('en_GB', 3, 3, 'Europe/London', 0, null);
$date = '2019-12-10 10:10:00';
echo date('Y-m-d H:i:s', $formatter->parse($date));

Expected result:
----------------
null

Actual result:
--------------
2016-06-10 09:10:00

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-13 09:49 UTC] cmb@php.net
-Type: Documentation Problem +Type: Bug
 [2019-05-22 10:45 UTC] andorsarig at yahoo dot com
Experienced a similar problem.

For example:
- with 'en_US' locale the function returns false.
- with 'de_DE' returns a timestamp which points with 8 years and a few months later.
 [2020-04-06 17:38 UTC] uaetech0 at gmail dot com
Most of the new bloggers starts thinking they will do well in future, But only few succeeds, like you. 
‘thank you for sharing information and apply your technique in website looking 
<a href=" https://printerrepairdubai.ae">  printer repair dubai </a>
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Jun 07 06:01:26 2020 UTC