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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: michal dot idzikowski at allegro dot pl
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 12:01:33 2025 UTC