0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 19:51:51 +00:00

- Be more verbose when trying to register extension after V8 is already initialized

This commit is contained in:
Jani Taskinen 2010-12-30 15:37:35 +00:00
parent c53dc7745f
commit 2568591d66

View File

@ -814,7 +814,7 @@ static int php_v8js_register_extension(char *name, uint name_len, char *source,
jsext->auto_enable = auto_enable; jsext->auto_enable = auto_enable;
jsext->name = zend_strndup(name, name_len); jsext->name = zend_strndup(name, name_len);
jsext->source = zend_strndup(source, source_len); jsext->source = zend_strndup(source, source_len);
if (jsext->deps) { if (jsext->deps) {
jsext->deps_ht = (HashTable *) malloc(sizeof(HashTable)); jsext->deps_ht = (HashTable *) malloc(sizeof(HashTable));
@ -847,6 +847,11 @@ static PHP_METHOD(V8Js, registerExtension)
int ext_name_len, script_len; int ext_name_len, script_len;
zend_bool auto_enable = 0; zend_bool auto_enable = 0;
if (V8JSG(v8_initialized)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "V8 engine already initialized. Cannot register extension");
RETURN_FALSE;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ab", &ext_name, &ext_name_len, &script, &script_len, &deps_arr, &auto_enable) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ab", &ext_name, &ext_name_len, &script, &script_len, &deps_arr, &auto_enable) == FAILURE) {
return; return;
} }