Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40896 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62041 invoked from network); 9 Oct 2008 13:57:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Oct 2008 13:57:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=dave@dmi.me.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dave@dmi.me.uk; sender-id=pass Received-SPF: pass (pb1.pair.com: domain dmi.me.uk designates 213.171.205.116 as permitted sender) X-PHP-List-Original-Sender: dave@dmi.me.uk X-Host-Fingerprint: 213.171.205.116 unknown Received: from [213.171.205.116] ([213.171.205.116:59682] helo=scaramanga.siterage.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/38-48736-5ED0EE84 for ; Thu, 09 Oct 2008 09:57:57 -0400 Received: from localhost (scaramanga.siterage.net [127.0.0.1]) by localhost.akadia.com (SiteRage Mail Server) with ESMTP id C1DCBCED0; Thu, 9 Oct 2008 14:57:54 +0100 (BST) X-Spam-Flag: NO X-Spam-Score: -3.847 X-Spam-Level: X-Spam-Status: No, score=-3.847 required=5 tests=[ALL_TRUSTED=-1.8, AWL=0.550, BAYES_00=-2.599, DNS_FROM_SECURITYSAGE=0.001, HTML_MESSAGE=0.001] Received: from scaramanga.siterage.net ([127.0.0.1]) by localhost (scaramanga.siterage.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id rTwKizTFzUlz; Thu, 9 Oct 2008 14:57:54 +0100 (BST) Received: from [192.168.201.2] (unknown [195.72.173.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by scaramanga.siterage.net (SiteRage Mail Server) with ESMTPSA id C5027CEC2; Thu, 9 Oct 2008 14:57:53 +0100 (BST) Message-ID: <48EE0DE1.1010603@dmi.me.uk> Date: Thu, 09 Oct 2008 14:57:53 +0100 User-Agent: Thunderbird 2.0.0.17 (X11/20080914) MIME-Version: 1.0 To: Stefan Walk CC: Lukas Kahwe Smith , David Coallier , internals@lists.php.net References: <48EDFEED.8080605@adplabs.com.br> <200810091551.23205.et@php.net> In-Reply-To: <200810091551.23205.et@php.net> X-Enigmail-Version: 0.95.7 Content-Type: multipart/alternative; boundary="------------080903050807080008040503" Subject: Re: [PHP-DEV] json_encode ignores protected/private class members From: dave@dmi.me.uk (Dave Ingram) --------------080903050807080008040503 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit >> 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 --------------080903050807080008040503--