0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 09:21:52 +00:00

Merge pull request #330 from stesie/mark-extensions-deprecated

Mark extensions deprecated
This commit is contained in:
Stefan Siegl 2017-09-25 14:37:07 +02:00 committed by GitHub
commit 07d3df9bb4
4 changed files with 24 additions and 3 deletions

View File

@ -13,7 +13,12 @@ var_dump(V8JS::getExtensions());
$a = new V8Js('myobj', array(), array('a'));
?>
===EOF===
--EXPECT--
--EXPECTF--
Deprecated: Function V8Js::registerExtension() is deprecated in %s%eextensions_basic.php on line 3
Deprecated: Function V8Js::registerExtension() is deprecated in %s%eextensions_basic.php on line 4
Deprecated: Function V8Js::getExtensions() is deprecated in %s%eextensions_basic.php on line 6
array(2) {
["a"]=>
array(2) {
@ -31,5 +36,7 @@ array(2) {
bool(false)
}
}
Deprecated: V8Js::__construct(): Use of extensions is deprecated, $extensions array passed in %s%eextensions_basic.php on line 8
Hello world!
===EOF===

View File

@ -13,6 +13,11 @@ var_dump(V8JS::getExtensions());
$a = new V8Js('myobj', array(), array('a'));
?>
--EXPECTF--
Deprecated: Function V8Js::registerExtension() is deprecated in %s%eextensions_circular_dependency.php on line 3
Deprecated: Function V8Js::registerExtension() is deprecated in %s%eextensions_circular_dependency.php on line 4
Deprecated: Function V8Js::getExtensions() is deprecated in %s%eextensions_circular_dependency.php on line 6
array(2) {
["a"]=>
array(2) {
@ -36,6 +41,8 @@ array(2) {
}
}
Deprecated: V8Js::__construct(): Use of extensions is deprecated, $extensions array passed in %s%eextensions_circular_dependency.php on line 8
Warning: Fatal V8 error in v8::Context::New(): Circular extension dependency in %s on line 8
Fatal error: Uncaught V8JsException: Failed to create V8 context. Check that registered extensions do not have errors. in %s:8

View File

@ -38,6 +38,8 @@ var_dump($v8);
===EOF===
--EXPECTF--
-- registerExtension --
Deprecated: Function V8Js::registerExtension() is deprecated in %s%eextensions_error.php on line 5
-- creating V8Js object --
Error installing extension 'handlebars'.

View File

@ -401,6 +401,11 @@ static PHP_METHOD(V8Js, __construct)
if (exts_arr)
{
exts_count = zend_hash_num_elements(Z_ARRVAL_P(exts_arr));
if (exts_count != 0) {
php_error_docref(NULL, E_DEPRECATED, "Use of extensions is deprecated, $extensions array passed");
}
if (v8js_create_ext_strarr(&exts, exts_count, Z_ARRVAL_P(exts_arr)) == FAILURE) {
zend_throw_exception(php_ce_v8js_exception,
"Invalid extensions array passed", 0);
@ -1267,8 +1272,8 @@ const zend_function_entry v8js_methods[] = { /* {{{ */
PHP_ME(V8Js, setTimeLimit, arginfo_v8js_settimelimit, ZEND_ACC_PUBLIC)
PHP_ME(V8Js, setMemoryLimit, arginfo_v8js_setmemorylimit, ZEND_ACC_PUBLIC)
PHP_ME(V8Js, setAverageObjectSize, arginfo_v8js_setaverageobjectsize, ZEND_ACC_PUBLIC)
PHP_ME(V8Js, registerExtension, arginfo_v8js_registerextension, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(V8Js, getExtensions, arginfo_v8js_getextensions, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(V8Js, registerExtension, arginfo_v8js_registerextension, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_DEPRECATED)
PHP_ME(V8Js, getExtensions, arginfo_v8js_getextensions, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_DEPRECATED)
PHP_ME(V8Js, createSnapshot, arginfo_v8js_createsnapshot, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
{NULL, NULL, NULL}
};