|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70154 date_parse() not returning false for missing time components
Submitted: 2015-07-27 14:05 UTC Modified: 2015-07-27 16:48 UTC
From: abodera at gmail dot com Assigned:
Status: Verified Package: Date/time related
PHP Version: 5.6.11 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-07-27 14:05 UTC] abodera at gmail dot com
date_parse() is expected to return false for missing values.

For example: 

    date_parse('1st Aug')['year'] === false;

As soon as you provide day of week, the hour, minute, second components magically become 0 (as in 00:00:00) even though they do not exist:

    date_parse('Sat 1st Aug')['hour'] === 0; // expected: false
    date_parse('Sat 1st Aug')['minute'] === 0; // expected: false
    date_parse('Sat 1st Aug')['second'] === 0; // expected: false


Test script:

print_r(date_parse('Sat 1st Aug'));


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-27 16:48 UTC]
-Status: Open +Status: Verified
 [2015-07-27 16:48 UTC]
I can confirm the different behavior.

It occurs to me that this might be an issue with
TIMELIB_UNHAVE_TIME[1], where h, i, s and f might have to be set

[1] <>
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Oct 19 19:01:27 2019 UTC