Re: [PHP-DEV] can't reflection on DateTime properties?

2016-06-05 Thread Stanislav Malyshev
Hi! > It's also impossible to write a PHP class with "internal state" - state > that I can't find at run-time with reflection. That's what makes the > language reflective. Internal state in this sense is something foreign > to PHP as well, the only exception being things like resources, but >

Re: [PHP-DEV] can't reflection on DateTime properties?

2016-06-05 Thread Rasmus Schultz
> Of course they are possible. See __get/__set Not the same thing at all - PDOStatement::$queryString is a read-only property, which cannot be overridden, not even with __get() as you would be able to for regular __get() in a regular PHP class. It's also impossible to write a PHP class with

Re: [PHP-DEV] can't reflection on DateTime properties?

2016-06-04 Thread Stanislav Malyshev
Hi! > I know that things like internal state and read-only properties are > possible for classes written in C, but those features aren't possible in > PHP code - classes that behave this way are inconsistent with classes Of course they are possible. See __get/__set. But yes, internal classes

Re: [PHP-DEV] can't reflection on DateTime properties?

2016-06-04 Thread Lester Caine
On 04/06/16 21:23, Stanislav Malyshev wrote: > In generic case, you can't have internal state of an object, that's why > it's internal. If you need to serialize data, there are > serialize/unserialize handlers for it. This is also why DateTime is useless for many data handling functions since

Re: [PHP-DEV] can't reflection on DateTime properties?

2016-06-04 Thread Fleshgrinder
On 6/4/2016 11:05 PM, Rasmus Schultz wrote: > I know that things like internal state and read-only properties are > possible for classes written in C, but those features aren't possible in > PHP code - classes that behave this way are inconsistent with classes > written in the language, and it

Re: [PHP-DEV] can't reflection on DateTime properties?

2016-06-04 Thread Rasmus Schultz
> In generic case, you can't have internal state of an object, that's why it's internal I know that things like internal state and read-only properties are possible for classes written in C, but those features aren't possible in PHP code - classes that behave this way are inconsistent with

Re: [PHP-DEV] can't reflection on DateTime properties?

2016-06-04 Thread Stanislav Malyshev
Hi! > The object clearly has properties corresponding to it's internal state, but > reflection doesn't seem to report them? Reflection reports defined properties, but classes can have dynamic properties that are not pre-defined. var_dump also has a separate handler, so the object can present

Re: [PHP-DEV] can't reflection on DateTime properties?

2016-06-04 Thread Eugene
On Sat, Jun 4, 2016 at 9:42 PM, Jordi Boggiano wrote: > On 04/06/2016 20:36, Rasmus Schultz wrote: > >> 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

Re: [PHP-DEV] can't reflection on DateTime properties?

2016-06-04 Thread Nikita Nefedov
On Sat, 04 Jun 2016 22:36:19 +0300, Rasmus Schultz wrote: 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();

Re: [PHP-DEV] can't reflection on DateTime properties?

2016-06-04 Thread Jordi Boggiano
On 04/06/2016 20:36, Rasmus Schultz wrote: 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:

[PHP-DEV] can't reflection on DateTime properties?

2016-06-04 Thread Rasmus Schultz
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)