|  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
 [2016-06-07 10:43 UTC] sajidm at gmx dot net
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:
   'date' => '2016-06-07 12:37:40',
   'timezone_type' => 3,
   'timezone' => 'Europe/Berlin',

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-07 10:53 UTC]
-Status: Open +Status: Not a bug -Package: *General Issues +Package: Date/time related -Assigned To: +Assigned To: cmb
 [2016-06-07 10:53 UTC]
> 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-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 01 21:01:27 2023 UTC