Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40890 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53296 invoked from network); 9 Oct 2008 13:32:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Oct 2008 13:32:13 -0000 Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 88.198.8.16 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 88.198.8.16 bigtime.backendmedia.com Linux 2.6 Received: from [88.198.8.16] ([88.198.8.16:48354] helo=bigtime.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A3/36-48736-CD70EE84 for ; Thu, 09 Oct 2008 09:32:12 -0400 Received: from localhost (unknown [127.0.0.1]) by bigtime.backendmedia.com (Postfix) with ESMTP id 13EEC414405C; Thu, 9 Oct 2008 13:33:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at backendmedia.com Received: from bigtime.backendmedia.com ([127.0.0.1]) by localhost (bigtime.backendmedia.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CbRl+hdDNbeP; Thu, 9 Oct 2008 15:33:07 +0200 (CEST) Received: from [192.168.80.161] (unknown [195.226.16.50]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mls@pooteeweet.org) by bigtime.backendmedia.com (Postfix) with ESMTP id 53A45414405A; Thu, 9 Oct 2008 15:33:07 +0200 (CEST) Cc: "Stefan Walk" , internals@lists.php.net Message-ID: To: "David Coallier" In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Date: Thu, 9 Oct 2008 15:31:54 +0200 References: <48EDFEED.8080605@adplabs.com.br> <261daaa10810090607h1876200ex1efa43a40cfb24c2@mail.gmail.com> <48EE0387.3040802@adplabs.com.br> <200810091517.37703.et@php.net> X-Mailer: Apple Mail (2.929.2) Subject: Re: [PHP-DEV] json_encode ignores protected/private class members From: mls@pooteeweet.org (Lukas Kahwe Smith) On 09.10.2008, at 15:26, David Coallier wrote: >>> Ok, nice solution, but I still don't see why json_encode ignores >>> protected/private class members. I mean, why we need this feature. >> >> Because, in theory, it shouldn't even be able to see those members? >> > > Stefan's right. Unless you are in the local scope or inheriting the > object you shouldn't be able to see those variables. And I have yet to > see > > classs Name extends json_decode($jsonValues) { } > > That's the point in having access modifiers. Unless I'm mistaking > there's no bug there. well .. i think this is at least the common use case. then again, json is an encoding format, and i expect that i can get the same object state by decoding. so the expectation to also get non public properties in the json encoded string is not totally crazy. 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. regards, Lukas Kahwe Smith mls@pooteeweet.org