Explorar o código

Create deprecated warning if setting $report_uncaught_exceptions != true

Stefan Siegl %!s(int64=7) %!d(string=hai) anos
pai
achega
82930c9ea9

+ 2 - 0
tests/exception_clearing.phpt

@@ -21,6 +21,8 @@ var_dump($v8->getPendingException());
 ?>
 ===EOF===
 --EXPECTF--
+Deprecated: V8Js::__construct(): Disabling exception reporting is deprecated, $report_uncaught_exceptions != true in %s%eexception_clearing.php on line 3
+
 Deprecated: Function V8Js::getPendingException() is deprecated in %s%eexception_clearing.php on line 5
 NULL
 

+ 2 - 0
tests/exception_propagation_2.phpt

@@ -38,6 +38,8 @@ try {
 ?>
 ===EOF===
 --EXPECTF--
+Deprecated: V8Js::__construct(): Disabling exception reporting is deprecated, $report_uncaught_exceptions != true in %s%eexception_propagation_2.php on line 8
+
 Deprecated: Function V8Js::getPendingException() is deprecated in %s%eexception_propagation_2.php on line 11
 object(V8JsScriptException)#%d (13) {
   ["message":protected]=>

+ 2 - 1
tests/exception_propagation_3.phpt

@@ -31,7 +31,8 @@ try {
 }
 ?>
 ===EOF===
---EXPECT--
+--EXPECTF--
+Deprecated: V8Js::__construct(): Disabling exception reporting is deprecated, $report_uncaught_exceptions != true in %s%eexception_propagation_3.php on line 8
 SyntaxError caught in JS!
 To Bar!
 Error caught via PHP callback!

+ 4 - 0
v8js_class.cc

@@ -357,6 +357,10 @@ static PHP_METHOD(V8Js, __construct)
 	ZVAL_NULL(&c->pending_exception);
 	c->in_execution = 0;
 
+	if (report_uncaught != 1) {
+		php_error_docref(NULL, E_DEPRECATED, "Disabling exception reporting is deprecated, $report_uncaught_exceptions != true");
+	}
+
 	new (&c->create_params) v8::Isolate::CreateParams();
 
 #ifdef USE_INTERNAL_ALLOCATOR