Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40943 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30642 invoked from network); 12 Oct 2008 14:08:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Oct 2008 14:08:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=danielc@analysisandsolutions.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=danielc@analysisandsolutions.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain analysisandsolutions.com from 166.84.1.73 cause and error) X-PHP-List-Original-Sender: danielc@analysisandsolutions.com X-Host-Fingerprint: 166.84.1.73 mail2.panix.com Received: from [166.84.1.73] ([166.84.1.73:60803] helo=mail2.panix.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AB/FE-46613-AE402F84 for ; Sun, 12 Oct 2008 10:08:42 -0400 Received: from panix3.panix.com (panix3.panix.com [166.84.1.3]) by mail2.panix.com (Postfix) with ESMTP id C15793480B; Sun, 12 Oct 2008 10:08:39 -0400 (EDT) Received: by panix3.panix.com (Postfix, from userid 14662) id D6B978FDDE; Sun, 12 Oct 2008 10:08:39 -0400 (EDT) Date: Sun, 12 Oct 2008 10:08:39 -0400 To: Jarismar Chaves da Silva Cc: PHP Internals List Message-ID: <20081012140839.GA22309@panix.com> 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> <4D.EB.48736.5C97EE84@pb1.pair.com> <48EF41F7.3020400@adplabs.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48EF41F7.3020400@adplabs.com.br> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: [PHP-DEV] json_encode ignores protected/private class members From: danielc@analysisandsolutions.com (Daniel Convissor) Hi Jaris: > I don't know if I'm using json_encode for something it's not supposed to > do. I'm using it to serialize an object to send it to another > runtime-environment in response to an remote call, just like what I can > do with SOAP, REST or RMI. In this context I don't see much sense in > preventing protected/private data from being transfered. So you are accessing the class from outside. This is exactly the situation where private and protected should not be visible. It's just like you're trying to access private properties from the wrong scope in PHP itself: p; // This will fail, as it should. You need to change your architecture to do what you want. --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409