You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segmentation fault when converting immutable and mutable DateTime instances created using reflection #8471
The segfault happens when converting an "incomplete" \DateTime to a \DateTimeImmutable instance and vice versa.
Background
I stumbled upon this during some unit test writing where my testing framework was unexpectedly mocking \DateTime objects for me. After debugging for a while I could narrow the cause down to the snippet above.
Solution
I'd love to attempt to provide a fix for this, but I am unsure as to the proper solution, implementation-wise: Should an error be thrown during the conversion, or during constructor-less creation of the reflection instance? Or maybe no errors at all and some "sane default" type of handling for creating DateTime instances via Reflection? Are there any precedents in the implementation for other internal classes in regards to this? Thanks in advance!
Activity
cmb69 commentedon May 2, 2022
I think so. It looks like
DATE_CHECK_INITIALIZED()checks are missing in the mentioned methods.