Re: Proposal for a RFC

From: Date: Tue, 07 May 2019 12:52:58 +0000
Subject: Re: Proposal for a RFC
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-105620@lists.php.net to get a copy of this message
> On 7 May 2019, at 19:47, Steven Wade <stevenwadejr@gmail.com> wrote: > >> Maybe I’m missing the point (I’ve never used it) of VarDumper, but isn’t this type of >> thing exactly why the __debugInfo magic method exists? > > > I can't speak for the exact reason a library like VarDumper is using casting versus > __debugInfo, but in trying to find a substitute this morning, I played with the method you mentioned > and found that it can be overwritten by classes and be commanded to not return anything (similar to > my __toArray proposal), whereas current functionality prevents overriding casting to an array so > casting will always give you insight but users can overwrite __debugInfo and cause unintended > effects. I assume that's the reason for not using __debugInfo. > > -- > Steven Wade > stevenwadejr@gmail.com > > > Right, I understand that it *can* be overridden, but surely if someone’s doing that, its because they want more useful information provided in, e.g. var_dump.

« previous php.internals (#105620) next »