Skip to content

Unexpected TypeError: Illegal invocation (same as #262 but how to reproduce the problem) #386

Closed
@chrisbckr

Description

@chrisbckr
class BaseClass {
	public function bla() {
	    echo "print bla";
	}
}

class Foo extends BaseClass {
    
}

class Bar extends BaseClass {
}

$v8 = new V8Js('PHP');
$v8->Foo = new Foo();
$v8->Bar = new Bar();

$code = <<<EOT

var_dump(PHP.Foo);
var_dump(PHP.Bar);

var_dump(PHP.Foo.bla());
var_dump(PHP.Bar.bla());
EOT;

$v8->executeString($code, 'test');

Result:

object(Foo)#1792350 (1) {
  ["bla"] =>
  object(Closure)#914656 {
      function () { [native code] }
  }
}
object(Bar)#1323981 (1) {
  ["bla"] =>
  object(Closure)#914656 {
      function () { [native code] }
  }
}
print blaNULL
PHP Fatal error:  Uncaught V8JsScriptException: test:6: TypeError: Illegal invocation in /root/v8js/teste.php:28
Stack trace:
#0 /root/v8js/teste.php(28): V8Js->executeString('\nvar_dump(PHP.F...', 'test')
#1 {main}
  thrown in /root/v8js/teste.php on line 28

Fatal error: Uncaught V8JsScriptException: test:6: TypeError: Illegal invocation in /root/v8js/teste.php:28
Stack trace:
#0 /root/v8js/teste.php(28): V8Js->executeString('\nvar_dump(PHP.F...', 'test')
#1 {main}
  thrown in /root/v8js/teste.php on line 28

PHP 7.0.32-2+0 20181015120515.7+jessie~1.gbpa6b8cf (cli) (built: Oct 15 2018 19:38:45) ( NTS )
libv8 7.2.99

Originally posted by @chrisbckr in #262 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions