FWIW I do prefer having a specific interface to do such conversions. I was
just trying to find a way to have list-like or Traversable objects ability
to be converted to plain array. This brings more problems than actually
solving. I will just stop thinking about this and can give this thread as
ref
I was not aware of all that being the only way to distinguish set/unset
properties.
I do agree with Marco on this point that it would be a BC break. It was not
my intention at all and did not foresee that.
Up to now, I thought array casting objects was doing the same as for scalar
values. I was wr
>
> > Same restrictions could be applied to this magic method:
> >
> http://us3.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring
> >
> > By this, I mean, no exceptions should be thrown in this method and return
> > value MUST be an array.
>
> Exceptions cannot be thrown from i
> I like the idea kind of, but would this remove the ability to cast to
> array all classes not implementing __toArray, as is the case with
> __toString? This would be a HUGE BC if so:
>
> $ php -r 'class Foo {public $foo = "foobar";} var_dump((array) (new Foo));'
> array(1) {
> ["foo"]=>
> str
nternal `__toString()` method and could explain
inconsistency of the `ArrayObject` class?
Regards,
Benoît Burnichon