Re: JSON inclusion in core
| From: | David | Date: | Sat, 21 Jan 2006 16:13:47 +0000 |
| Subject: | Re: JSON inclusion in core | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-21627@lists.php.net to get a copy of this message | ||
Andi Gutmans wrote:
At 04:25 AM 1/21/2006, Jared Williams wrote:Just as the classmap option for ext/soap? Regards, DavidWhat are the security implications of doing this? Creating objects based on a string from a untrusted source seems not good idea, unless can prevent tampering (with an HMAC or something).Well I think the right thing to do is pass an array of "allowed" classes into json_decode() and raise an error/exception if it's not in the list. I think it wasn't clear to some people why this is needed. I think enabling the seamless mapping of objects in between the client and server is extremely useful. It'll save PHP developers from having to unpack/pack their PHP objects into the right structures. So basically I think there should be a way for an object to say what it's key/value pairs are (__json_serialize_elements()?) and during decode() allow to map directly to classes. In both cases I think if neither a serializing interface is implemented, nor are valid "classes" provided to decode() it should work like today via StdClass.