Browse Source

Fix for SetFatalErrorHandler. This needs to be called for every context isolate.

Simon Best 12 years ago
parent
commit
e778b6d7af
1 changed files with 4 additions and 3 deletions
  1. 4 3
      v8js.cc

+ 4 - 3
v8js.cc

@@ -518,9 +518,6 @@ static void php_v8js_init(TSRMLS_D) /* {{{ */
 	/* Initialize V8 */
 	v8::V8::Initialize();
 
-	/* Redirect fatal errors to PHP error handler */
-	v8::V8::SetFatalErrorHandler(php_v8js_fatal_error_handler);
-
 	/* Run only once */
 	V8JSG(v8_initialized) = 1;
 }
@@ -582,6 +579,10 @@ static PHP_METHOD(V8Js, __construct)
 	/* Handle scope */
 	v8::HandleScope handle_scope(c->isolate);
 
+	/* Redirect fatal errors to PHP error handler */
+	// This needs to be done within the context isolate
+	v8::V8::SetFatalErrorHandler(php_v8js_fatal_error_handler);
+
 	/* Create global template for global object */
 	// Now we are using multiple isolates this needs to be created for every context