-
Notifications
You must be signed in to change notification settings - Fork 205
Closed
Labels
Description
If a JavaScript object is passed back to PHP and the PHP code then calls a method on that object, this points to the global object (within the method) instead of to the JS object itself.
php > $v8 = new V8Js();
php > $v8->executeString('function Bar(i) { this.theValue = i; }');
php > $v8->executeString('Bar.prototype.tell = function() { var_dump(this.theValue); }; ');
php > $v8->executeString('var inst = new Bar(23); ');
php > $v8->executeString('inst.tell(); ');
int(23)
php > $inst = $v8->executeString('(inst)');
php > $inst->tell();
NULL