php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72354 var_export print extra precision for datetime variable
Submitted: 2016-06-07 10:43 UTC Modified: 2016-06-07 10:53 UTC
From: sajidm at gmx dot net Assigned: cmb (profile)
Status: Not a bug Package: Date/time related
PHP Version: 5.6.22 OS: linux but may be all
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: sajidm at gmx dot net
New email:
PHP Version: OS:

 

 [2016-06-07 10:43 UTC] sajidm at gmx dot net
Description:
------------
if you print datetime variable with var_export function it will print extra precision digits with zeros. This behaviour is since version 5.6.x.





Test script:
---------------
php -r '$d=new DateTime("2016-06-07 12:37:40");var_export($d);echo "\n";'


Expected result:
----------------
DateTime::__set_state(array(
   'date' => '2016-06-07 12:37:40',
   'timezone_type' => 3,
   'timezone' => 'Europe/Berlin',
))

Actual result:
--------------
DateTime::__set_state(array(
   'date' => '2016-06-07 12:37:40.000000',
   'timezone_type' => 3,
   'timezone' => 'Europe/Berlin',
))

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-07 10:53 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Package: *General Issues +Package: Date/time related -Assigned To: +Assigned To: cmb
 [2016-06-07 10:53 UTC] cmb@php.net
> This behaviour is since version 5.6.x.

Actually, it is so as of PHP 5.5.14, due to fixing bug #67308. It
seems very reasonable to me that var_export() also exports the
*exact* time, so this is not a bug, in my opinion.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 17:01:32 2024 UTC