Repository navigation
Conversation
|
This seems more like a behavior we should fix rather than test. |
|
@nikic I'm actually gaining huge performance improvements from this by avoiding reflection. If this is unexpected behavior, then an alternate solution that gives me an array copy of an object could be required. This representation actually makes a lot of sense to me, since it allows me to get data for larger hierarchies too: class Foo
{
private $bar;
}
class Bar extends Foo
{
private $bar;
}
class Baz extends Bar
{
private $bar;
}
var_dump((array) new Baz()); // gives me 3 keys - awesome!Via reflection, I have to re-build all this myself, resulting in quite a mess, especially given the ORM performance requirements. I actually think it's a really nice feature. |
|
Recap after discussion on http://chat.stackoverflow.com/transcript/message/10116460#10116460 :
/cc @jpauli |
|
I'm not a big fan of exposing internal implementation, but I guess there's no harm in making any further change in this area explicit. |
|
Comment on behalf of stas at php.net: merged |
This PR simply introduces two tests to prevent unwanted BC breaks in how objects are converted to arrays.
This (as far as I know) happens in two cases:
$data = (array) $object;__sleepThis PR simply adds tests that verify the keys of the arrays being generated.