Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When using fromTimeStamp with utc=true, make sure to initialise the t…
…imezone to UTC Summary: Without this change, the following code: c_dt = HPHP::Unit::lookupClass(HPHP::s_DateTime.get()); assert(c_dt); HPHP::ObjectData* obj = HPHP::ObjectData::newInstance(c_dt); DateTimeData* data = Native::data<DateTimeData>(obj); data->m_dt = makeSmartPtr<DateTime>(0, false); data->m_dt->fromTimeStamp(milliseconds / 1000, true); Would cause issues when var_dumping the returned object. var_dump would call debugInfo on the object, which in turns tries to use zone_type_to_string, which has an assertion if it can't find the type. With the above example, the zone type would be false, and we'd get this assertion: Program received signal SIGABRT, Aborted. 0x00007fffeeae5107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 0x00007fffeeae5107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007fffeeae64e Closes facebook#5547 Reviewed By: @sgolemon Differential Revision: D2197285
- Loading branch information