Re: json_encode ignores protected/private class members

From: Date: Thu, 09 Oct 2008 14:00:29 +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-40897@lists.php.net to get a copy of this message
Ron Rademaker wrote: > Stefan Walk wrote: >> 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). > Looking at our current JSON implementations, such an interface would > be very very welcome. If at all possible something like JSONDecodable > would be great as well, for restoring class members from json. I'm thinking about getting involved with some PHP internals, so this might be as good a place to start as any, unless someone else is particularly interested or motivated. Having said that, I had first planned to make some minor changes to the apache2 SAPI to solve a long-requested feature. I haven't yet looked into why the Apache hasn't been implemented yet though, so I didn't want to propose it yet. Dave

« previous php.internals (#40897) next »