can't reflection on DateTime properties?

From: Date: Sat, 04 Jun 2016 19:36:19 +0000
Subject: can't reflection on DateTime properties?
Groups: php.internals 
Request: Send a blank email to internals+get-93777@lists.php.net to get a copy of this message
I wrote a library that can serialize/unserialize PHP object graphs to JSON data. Somebody reported it doesn't work on the DateTime class. Does this deliberately not work? $date = new DateTime(); var_dump($date); outputs: object(DateTime)#1 (3) { ["date"]=> string(19) "2016-06-04 19:30:19" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } however, this... $reflection = new ReflectionClass('DateTime'); var_dump($reflection->getProperties()); outputs: array(0) { } The object clearly has properties corresponding to it's internal state, but reflection doesn't seem to report them? Also, what comes out of var_dump() appears to be something intended for human consumption? I'm guessing that's not the actual internal state of the object - most likely the internal state consists of the "timezone_type" and an integer timestamp?

« previous php.internals (#93777) next »