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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
7 + 15 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Apr 18 11:01:28 2024 UTC