0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-23 04:51:53 +00:00

Code folding marks and comments

This commit is contained in:
Stefan Siegl 2014-04-13 22:59:35 +02:00
parent 6f31840daf
commit 659c0fb601
2 changed files with 13 additions and 1 deletions

View File

@ -1134,6 +1134,8 @@ static PHP_METHOD(V8Js, executeString)
php_v8js_timer_pop(TSRMLS_C); php_v8js_timer_pop(TSRMLS_C);
} }
/* Check for fatal error marker possibly set by php_v8js_error_handler; just
* rethrow the error since we're now out of V8. */
if(V8JSG(fatal_error_abort)) { if(V8JSG(fatal_error_abort)) {
zend_error(V8JSG(error_num), "%s", V8JSG(error_message)); zend_error(V8JSG(error_num), "%s", V8JSG(error_message));
} }

View File

@ -31,7 +31,13 @@ extern "C" {
#include <limits> #include <limits>
static void php_v8js_error_handler(int error_num, const char *error_filename, const uint error_lineno, const char *format, va_list args) /* Callback for PHP's zend_error_cb; catching any fatal PHP error.
* The callback is installed in the lowest (stack wise) php_v8js_call_php_func
* frame. Just store the error message and jump right back there and fall
* back into V8 context. */
static void php_v8js_error_handler(int error_num, const char *error_filename,
const uint error_lineno, const char *format,
va_list args) /* {{{ */
{ {
char *buffer; char *buffer;
int buffer_len; int buffer_len;
@ -44,6 +50,7 @@ static void php_v8js_error_handler(int error_num, const char *error_filename, co
longjmp(*V8JSG(unwind_env), 1); longjmp(*V8JSG(unwind_env), 1);
} }
/* }}} */
static void php_v8js_weak_object_callback(const v8::WeakCallbackData<v8::Object, zval> &data); static void php_v8js_weak_object_callback(const v8::WeakCallbackData<v8::Object, zval> &data);
@ -153,6 +160,9 @@ static void php_v8js_call_php_func(zval *value, zend_class_entry *ce, zend_funct
void (*old_error_handler)(int, const char *, const uint, const char*, va_list); void (*old_error_handler)(int, const char *, const uint, const char*, va_list);
/* If this is the first level call from V8 back to PHP, install a
* handler for fatal errors; we must fall back through V8 to keep
* it from crashing. */
if (V8JSG(unwind_env) == NULL) { if (V8JSG(unwind_env) == NULL) {
old_error_handler = zend_error_cb; old_error_handler = zend_error_cb;
zend_error_cb = php_v8js_error_handler; zend_error_cb = php_v8js_error_handler;