Skip to content

Commit 2cedd40

Browse files
committed
Test results changed in revised issue phpv8#72 patch, w/ read-only export.
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.
1 parent ec8b16f commit 2cedd40

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

tests/derived_class_properties_init.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ class V8Wrapper extends V8Js {
1313

1414
$v8 = new V8Wrapper();
1515
echo($v8->testing."\n");
16+
// These are all properties of V8Wrapper, not exported to V8
1617
$v8->executeString('print(PHP.testing + "\n");');
1718
$v8->executeString('print(PHP.protectedVar + "\n");');
1819
$v8->executeString('print(PHP.privateVar + "\n");');
1920
?>
2021
===EOF===
2122
--EXPECT--
2223
23
23-
23
24+
undefined
2425
undefined
2526
undefined
2627
===EOF===

tests/get_accessor.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ myobj.$foobar = 'CHANGED'; // should be read only!
1515
print(myobj.$foobar + "\n"); // Undefined (in 1st run!)
1616
EOT;
1717

18-
$a = new V8Js("myobj", array('$_SERVER' => '_SERVER', '$foobar' => 'myfoobar'));
18+
$myfoobar = 'undefined';
19+
20+
$a = new V8Js("myobj", array('_SERVER' => &$_SERVER, 'foobar' => &$myfoobar));
1921
$a->executeString($JS, "test1.js");
2022

2123
$myfoobar = 'myfoobarfromphp';
@@ -37,5 +39,5 @@ myfoobarfromphp
3739
%d
3840
myfoobarfromphp
3941
NULL
40-
NULL
42+
string(15) "myfoobarfromphp"
4143
===EOF===

tests/object.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ var_dump($a->myobj->foo);
4545
mytest => function () { [native code] }
4646
$foo => ORIGINAL
4747
Here be monsters..
48-
CHANGED
49-
string(7) "CHANGED"
48+
ORIGINAL
49+
string(8) "ORIGINAL"
5050
===EOF===

0 commit comments

Comments
 (0)