php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69812 MongoDate::toDateTime() returing incorrect value?
Submitted: 2015-06-12 13:33 UTC Modified: -
Votes:7
Avg. Score:3.7 ± 0.9
Reproduced:7 of 7 (100.0%)
Same Version:0 (0.0%)
Same OS:6 (85.7%)
From: shabbir dot r dot bhojani at gmail dot com Assigned:
Status: Open Package: mongo (PECL)
PHP Version: 5.5.26 OS: Windows
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: shabbir dot r dot bhojani at gmail dot com
New email:
PHP Version: OS:

 

 [2015-06-12 13:33 UTC] shabbir dot r dot bhojani at gmail dot com
Description:
------------
Executing the example from http://php.net/manual/en/mongodate.todatetime.php produces an incorrect DateTime value on Windows, works fine on Linux. 

Test script:
---------------
<?php
$d = new MongoDate(strtotime("2014-11-18 11:01:25"));
var_dump( $d->toDateTime() );

Expected result:
----------------
class DateTime#2 (3) {
  public $date =>
  string(26) "2014-11-18 11:01:25.000000"
  public $timezone_type =>
  int(1)
  public $timezone =>
  string(6) "+00:00"
}

Actual result:
--------------
object(DateTime)[8]
  public 'date' => string '1969-12-20 00:41:17.320000' (length=26)
  public 'timezone_type' => int 1
  public 'timezone' => string '+00:00' (length=6)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-16 08:13 UTC] agr at concoursmania dot com
I can reproduce the issue with PHP 5.6.11, package mongo 1.6.6 on Linux.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 29 01:01:28 2024 UTC