Re: Re: [PATCH] Make var_export() output "(object)array(..." instead of"stdClass::__set_state(..." for stdClass
| From: | Andreas Hennings | Date: | Sat, 07 Jul 2018 11:13:56 +0000 |
| Subject: | Re: Re: [PATCH] Make var_export() output "(object)array(..." instead of"stdClass::__set_state(..." for stdClass | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-102634@lists.php.net to get a copy of this message | ||
I do not disagree, just want to make an observation.
If multiple properties or array keys reference the same instance of
\stdClass, there will be multiple instances with identical values after a
round-trip with var_export() + eval().
This is not necessarily a problem, just something to be aware of.
On Wed, 4 Jul 2018 at 22:33, Christoph M. Becker <cmbecker69@gmx.de> wrote:
> On 14.03.2017 at 19:57, Andrea Faulds wrote:
>
> > Since stdClass has no __set_state method, var_export() produces unusable
> > output if given an object of that class. I wrote a patch that would make
> > var_export() produce a cast to object instead, which could be evaluated
> > to get back a stdClass:
> >
> > https://github.com/php/php-src/pull/2420
> >
> > Any thoughts/comments?
> >
> > If you're wondering about whether a __set_state method should be added
> > to stdClass, I posted some thoughts in the pull request discussion
> already.
>
> FTR: If nobody objects, I'll merge this PR into master on 2018-07-12, so
> that it goes into PHP 7.3.
>
> See
> <https://github.com/php/php-src/pull/2420#issuecomment-402561913>.
>
> --
> Christoph M. Becker
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>