Re: json_encode ignores protected/private class members

From: Date: Thu, 09 Oct 2008 13:57:53 +0000
Subject: Re: json_encode ignores protected/private class members
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-40896@lists.php.net to get a copy of this message
>> 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

« previous php.internals (#40896) next »