Re: json_encode ignores protected/private class members
| From: | Jarismar Chaves da Silva | Date: | Thu, 09 Oct 2008 13:42:12 +0000 |
| Subject: | Re: json_encode ignores protected/private class members | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-40891@lists.php.net to get a copy of this message | ||
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.
Stefan Walk wrote:
On Thursday 09 October 2008 15:13:43 Jarismar Chaves da Silva 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? Regards, Stefan -- *Jarismar Chaves da Silva, M.Sc.* *ADP**Labs** Brazil** *jarismar_silva@adplabs.com.br <mailto:jarismar_silva@adplabs.com.br> http://www.adp.com