mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 09:21:52 +00:00
Don't export V8Js methods even if overwritten
This commit is contained in:
parent
1e86e2c9f7
commit
d438624a3d
44
tests/issue_183_004.phpt
Normal file
44
tests/issue_183_004.phpt
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
--TEST--
|
||||||
|
Test V8::executeString() : Method access on derived classes (overridden V8Js methods)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Foo extends \V8Js
|
||||||
|
{
|
||||||
|
public function hello()
|
||||||
|
{
|
||||||
|
print("Hello World\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function executeString($script, $identifier = NULL, $flags = NULL, $time_limit = NULL, $memory_limit = NULL)
|
||||||
|
{
|
||||||
|
var_dump("executeString");
|
||||||
|
return parent::executeString($script);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$JS = <<< EOT
|
||||||
|
var_dump(typeof PHP.hello);
|
||||||
|
var_dump(typeof PHP.executeString);
|
||||||
|
|
||||||
|
try {
|
||||||
|
PHP.executeString('print("blar")');
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
var_dump('caught');
|
||||||
|
}
|
||||||
|
EOT;
|
||||||
|
|
||||||
|
$v8 = new Foo();
|
||||||
|
$v8->executeString($JS);
|
||||||
|
|
||||||
|
?>
|
||||||
|
===EOF===
|
||||||
|
--EXPECTF--
|
||||||
|
string(13) "executeString"
|
||||||
|
string(8) "function"
|
||||||
|
string(9) "undefined"
|
||||||
|
string(6) "caught"
|
||||||
|
===EOF===
|
@ -531,7 +531,7 @@ static PHP_METHOD(V8Js, __construct)
|
|||||||
|
|
||||||
const zend_function_entry *fe;
|
const zend_function_entry *fe;
|
||||||
for (fe = v8js_methods; fe->fname; fe ++) {
|
for (fe = v8js_methods; fe->fname; fe ++) {
|
||||||
if (fe->fname == method_ptr->common.function_name) {
|
if (strcmp(fe->fname, method_ptr->common.function_name) == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1186,7 +1186,7 @@ static void v8js_unset_property(zval *object, zval *member ZEND_HASH_KEY_DC TSRM
|
|||||||
/* Global PHP JS object */
|
/* Global PHP JS object */
|
||||||
v8::Local<v8::String> object_name_js = v8::Local<v8::String>::New(isolate, c->object_name);
|
v8::Local<v8::String> object_name_js = v8::Local<v8::String>::New(isolate, c->object_name);
|
||||||
v8::Local<v8::Object> jsobj = V8JS_GLOBAL(isolate)->Get(object_name_js)->ToObject();
|
v8::Local<v8::Object> jsobj = V8JS_GLOBAL(isolate)->Get(object_name_js)->ToObject();
|
||||||
|
|
||||||
/* Delete value from PHP JS object */
|
/* Delete value from PHP JS object */
|
||||||
jsobj->Delete(V8JS_SYML(Z_STRVAL_P(member), Z_STRLEN_P(member)));
|
jsobj->Delete(V8JS_SYML(Z_STRVAL_P(member), Z_STRLEN_P(member)));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user