php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #79458 Microseconds parameter "u" needs 6 digits, not "up to" in <5.3.7
Submitted: 2020-04-08 10:50 UTC Modified: 2020-04-08 11:05 UTC
From: michal dot idzikowski at allegro dot pl Assigned: cmb (profile)
Status: Not a bug Package: Date/time related
PHP Version: Irrelevant OS: n/a
Private report: No CVE-ID: None
 [2020-04-08 10:50 UTC] michal dot idzikowski at allegro dot pl
Description:
------------
---
From manual page: https://php.net/datetime.createfromformat
---

Format character "u" doesn't handle correctly "up to" 6 characters microseconds values in PHP < 5.3.7. I think it should be stated in docs, because system working on such version still exists because of register_globals and few other breaking changes.

I choose version as "irrevelant", because docs are just misleading, no matter if it hits version 5 or 7 :)

Test script:
---------------
<?php
$dt = DateTime::createFromFormat('u', '123');
var_dump($dt);
var_dump(DateTime::getLastErrors());

Expected result:
----------------
I don't think there will be fix released for PHP5, so it could be nice to see docs updated.

Actual result:
--------------
No info in docs that "u" format character works differently on older PHP versions.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-04-08 11:05 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-04-08 11:05 UTC] cmb@php.net
Obviously, there was a respective bug in PHP 5.3.1 and 5.3.2[1],
but usually we do not document bugs and bug fixes in the manual,
and I cannot imagine anybody still running one of these versions
in their right mind.

[1] <https://3v4l.org/sNTP8#v531>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 10:01:30 2024 UTC