Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.2.1 created_at, and updated_at stored as 0. #1131

Closed
azhard4int opened this issue Feb 26, 2017 · 17 comments · Fixed by #1148
Closed

v3.2.1 created_at, and updated_at stored as 0. #1131

azhard4int opened this issue Feb 26, 2017 · 17 comments · Fixed by #1148

Comments

@azhard4int
Copy link

Hi,

After the recent update, the created_at and updated_at values are stored as shown below:

[updated_at] => MongoDate Object (
[sec] => 0
[usec] => 0
)
[created_at] => MongoDate Object (
[sec] => 0
[usec] => 0
)

@azhard4int
Copy link
Author

@jenssegers downgrading to v3.2.0 fixed the datetime issue, I am using laravel 5.3.

@jenssegers
Copy link
Contributor

Damn that is weird, I'll check it out.

jenssegers added a commit that referenced this issue Feb 26, 2017
@jenssegers
Copy link
Contributor

I'm not seeing this behaviour in my unit tests though

@staf
Copy link

staf commented Feb 27, 2017

Can confirm this is happening for us as well in several of our projects after upgrading to 3.2.1

edit:
I updated to the 1.2 version of the mongodb extension which solved the issue on my local machine. Using the 1.1 version gives incorrect timestamps.
Also on Laravel 5.3 (for now)

@azhard4int
Copy link
Author

@staf are you running php 7 or php 5?

@staf
Copy link

staf commented Feb 27, 2017

I'm running 7. A coworker on 5.6 had the same issue. But a driver upgrade from 1.1 to 1.2 solved it in either case.

@mario-laserna
Copy link

Hi, I am having a similar issue, dates (created_at, updated_at) of all models are saving like ISODate("1970-01-01T00:00:00Z"), always this same date

I had to downgrade to 3.2.0 and all works fine again, I have this problem only in server (Ubuntu 14 and PHP 7.0) but not in my machine (win10, php7.0)

@acidjazz
Copy link

confirmed, php7, both of my setups, laravel 5.4 and lumen 5.2, all 6 of my models

@sebbZA
Copy link

sebbZA commented Mar 1, 2017

Issue exists with PHP 7.0 and MongoDB 1.2.5 driver. Had to downgrade to 3.2.0 and its working.

@mario-laserna
Copy link

@jenssegers this is happening now with version 3.2.0 on win10 also

@jenssegers
Copy link
Contributor

Could someone do a PR to revert the previous change to fix this issue?

@Endijs
Copy link

Endijs commented Mar 8, 2017

I also had the same problem. Updated mongodb driver and problem was fixed. I'm using PHP 7. Those who experience this issue, try updating mongodb driver.

@acidjazz
Copy link

acidjazz commented Mar 8, 2017

@Endijs to what version? i always keep mine up to date

@Endijs
Copy link

Endijs commented Mar 8, 2017

@acidjazz
$ php -v
PHP 7.0.13-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.13-0ubuntu0.16.04.1, Copyright (c) 1999-2016, by Zend Technologies

$ php --ri mongodb

mongodb

MongoDB support => enabled
MongoDB extension version => 1.2.5
MongoDB extension stability => stable
libbson bundled version => 1.5.4
libmongoc bundled version => 1.5.4
libmongoc SSL => enabled
libmongoc SSL library => OpenSSL
libmongoc crypto => enabled
libmongoc crypto library => libcrypto
libmongoc crypto system profile => disabled
libmongoc SASL => disabled

@acidjazz
Copy link

acidjazz commented Mar 8, 2017

@Endijs you sure your dates are being stored correctly now?

if this is the solution then @jenssegers can we somehow put a stipulation on this version to require that version of the php driver to help avoid this severe issue?

@Endijs
Copy link

Endijs commented Mar 8, 2017

@acidjazz Well - for me it worked out (just like for @staf ). At least i can't spot any new records with 0 anymore. However @domagala is also using 1.2.5 and is reporting that issue still persists. Thus it looks like sometimes that fixes the problem, but not always. Maybe something else is at play here.
But it's good place to start for those who are having this issue. Try updating mongodb driver and report if that helps or not.

@divine
Copy link
Contributor

divine commented Feb 14, 2020

Closing, merged in #1148.

@divine divine closed this as completed Feb 14, 2020
mnphpexpert added a commit to mnphpexpert/laravel-mongodb that referenced this issue Sep 2, 2024
mnphpexpert added a commit to mnphpexpert/laravel-mongodb that referenced this issue Sep 2, 2024
mnphpexpert added a commit to mnphpexpert/laravel-mongodb that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants