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
[EMAIL PROTECTED]




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to