mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 04:01:51 +00:00
fix exception back-propagation on PHP7
This commit is contained in:
parent
5cba44ccd0
commit
296b9078ff
@ -34,7 +34,7 @@ catch(V8JsScriptException $e) {
|
||||
--EXPECTF--
|
||||
after getException
|
||||
Got V8JsScriptException
|
||||
string(%d) "php_exceptions_005:3: exception 'Exception' with message 'Test-Exception' in %s
|
||||
string(%d) "php_exceptions_005:3: Exception: Test-Exception in %s
|
||||
Stack trace:
|
||||
#0 [internal function]: Foo->getException()
|
||||
#1 %s: V8Js->executeString('var ex = PHP.fo...', 'php_exceptions_...')
|
||||
|
@ -88,12 +88,12 @@ void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8::
|
||||
|
||||
if(!php_ref.IsEmpty()) {
|
||||
assert(php_ref->IsExternal());
|
||||
zval *php_exception = reinterpret_cast<zval *>(v8::External::Cast(*php_ref)->Value());
|
||||
zend_object *php_exception = reinterpret_cast<zend_object *>(v8::External::Cast(*php_ref)->Value());
|
||||
|
||||
zend_class_entry *exception_ce = zend_exception_get_default(TSRMLS_C);
|
||||
if (Z_TYPE_P(php_exception) == IS_OBJECT && instanceof_function(Z_OBJCE_P(php_exception), exception_ce TSRMLS_CC)) {
|
||||
Z_ADDREF_P(php_exception);
|
||||
zend_exception_set_previous(Z_OBJ_P(return_value), Z_OBJ_P(php_exception));
|
||||
if (instanceof_function(php_exception->ce, exception_ce TSRMLS_CC)) {
|
||||
++GC_REFCOUNT(php_exception);
|
||||
zend_exception_set_previous(Z_OBJ_P(return_value), php_exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user