Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40899 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62007 invoked from network); 9 Oct 2008 21:38:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Oct 2008 21:38:15 -0000 X-Host-Fingerprint: 189.122.87.230 unknown Received: from [189.122.87.230] ([189.122.87.230:2817] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/EB-48736-5C97EE84 for ; Thu, 09 Oct 2008 17:38:14 -0400 Message-ID: <4D.EB.48736.5C97EE84@pb1.pair.com> To: internals@lists.php.net Date: Thu, 09 Oct 2008 18:43:00 -0300 User-Agent: Thunderbird 2.0.0.16 (X11/20080707) MIME-Version: 1.0 References: <48EDFEED.8080605@adplabs.com.br> <261daaa10810090607h1876200ex1efa43a40cfb24c2@mail.gmail.com> <48EE0387.3040802@adplabs.com.br> <200810091517.37703.et@php.net> <48EE0A34.8020903@adplabs.com.br> In-Reply-To: <48EE0A34.8020903@adplabs.com.br> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 189.122.87.230 Subject: Re: [PHP-DEV] json_encode ignores protected/private class members From: rodrigo.saboya@bolsademulher.com (Rodrigo Saboya) Jarismar Chaves da Silva wrote: > I agree with you. > But when using json_encode I believe the developer wants to transfer the > complete object state, just like when using serialize. > Serialize does see private/protected class members, while json_encode not. > Javascript does not have class-accessors so why not convert > protected/private to public javascript attributes. In theory only the public members are relevant to anyone except the object itself. If you need information about private/protected members you are either using the wrong visibility for your variables or using json for something it's not supposed to do. -- Rodrigo Saboya