Re: json_encode ignores protected/private class members

From: Date: Thu, 09 Oct 2008 14:44:55 +0000
Subject: Re: json_encode ignores protected/private class members
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-40898@lists.php.net to get a copy of this message
Yes, it like it too. Just like an OOP should be. Dave Ingram wrote:
however changing this at this point would be a huge security issue, so if at all, it would need to be handled by an optional parameter that defaults to false.
          
That would be unclean. If it's implemented in some way, json_encode should look for the implementation of some interface (JSONEncodable or something) providing encoding/decoding methods (similar to __sleep/__wakeup).
I must say that does sound like a very elegant way of doing things. Then the default for __json_encode() would encode the public members, and there would be no default __json_decode(), I suppose. Dave
-- *Jarismar Chaves da Silva, M.Sc.* *ADP**Labs** Brazil** *+55 51 3327 1491 -- Direct +55 51 9947 3613 -- Mobile jarismar_silva@adplabs.com.br <mailto:jarismar_silva@adplabs.com.br> http://www.adp.com This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.

« previous php.internals (#40898) next »