Skip to content

Commit

Permalink
Test results changed in revised issue phpv8#72 patch, w/ read-only ex…
Browse files Browse the repository at this point in the history
…port.

There is a minor change to how properties of V8Js subclasses are exposed to
JavaScript: subclass properties are *not* visible to JS by default.

We preserve the read-only status of PHP objects exposed via V8Js properties
by adding a hidden read-only flag to the V8 wrappers.  PHP objects exposed
to JS by other means (for example, return values of method invocations)
are not read-only.
  • Loading branch information
cscott committed Oct 29, 2013
1 parent ec8b16f commit 2cedd40
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion tests/derived_class_properties_init.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ class V8Wrapper extends V8Js {

$v8 = new V8Wrapper();
echo($v8->testing."\n");
// These are all properties of V8Wrapper, not exported to V8
$v8->executeString('print(PHP.testing + "\n");');
$v8->executeString('print(PHP.protectedVar + "\n");');
$v8->executeString('print(PHP.privateVar + "\n");');
?>
===EOF===
--EXPECT--
23
23
undefined
undefined
undefined
===EOF===
6 changes: 4 additions & 2 deletions tests/get_accessor.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ myobj.$foobar = 'CHANGED'; // should be read only!
print(myobj.$foobar + "\n"); // Undefined (in 1st run!)
EOT;

$a = new V8Js("myobj", array('$_SERVER' => '_SERVER', '$foobar' => 'myfoobar'));
$myfoobar = 'undefined';

$a = new V8Js("myobj", array('_SERVER' => &$_SERVER, 'foobar' => &$myfoobar));
$a->executeString($JS, "test1.js");

$myfoobar = 'myfoobarfromphp';
Expand All @@ -37,5 +39,5 @@ myfoobarfromphp
%d
myfoobarfromphp
NULL
NULL
string(15) "myfoobarfromphp"
===EOF===
4 changes: 2 additions & 2 deletions tests/object.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ var_dump($a->myobj->foo);
mytest => function () { [native code] }
$foo => ORIGINAL
Here be monsters..
CHANGED
string(7) "CHANGED"
ORIGINAL
string(8) "ORIGINAL"
===EOF===

0 comments on commit 2cedd40

Please sign in to comment.