preillyme/v8js — pull request #90 by stesie (2014-04-11 19:13:29+00:00)
Title: Fix visibility of PHP properties in JS

Hi there,

this effectively fixes #79 ... and some related stuff :)

Read access to private and protected properties of exported PHP objects is no longer granted, instead they are hidden. This even allows to assign values on JS side without name conflicts (and no overwriting).

Furthermore __get is now called if the magic method is present and a private/protected property is accessed. Likewise __set is now called if a private/protected property is tried to be set.
If there is no __set, the property is overwritten on JS side, hence subsequent reads get the value assigned on JS side; but the PHP side value is not changed any longer.

Trying to delete private/protected properties from PHP objects resulted in fatal PHP errors; this is now handled well. The PHP property is not affected.

Enumeration and hasOwnProperty of private/protected properties already behaved expected; I just added tests there.

cheers
~stesie