From 82930c9ea9bd1e84c3069c021010ac69f1153fa8 Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Mon, 25 Sep 2017 14:35:46 +0200 Subject: [PATCH] Create deprecated warning if setting $report_uncaught_exceptions != true --- tests/exception_clearing.phpt | 2 ++ tests/exception_propagation_2.phpt | 2 ++ tests/exception_propagation_3.phpt | 3 ++- v8js_class.cc | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/exception_clearing.phpt b/tests/exception_clearing.phpt index 27d9f8c..c48a26c 100644 --- a/tests/exception_clearing.phpt +++ b/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 diff --git a/tests/exception_propagation_2.phpt b/tests/exception_propagation_2.phpt index 6c86cdb..718856d 100644 --- a/tests/exception_propagation_2.phpt +++ b/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]=> diff --git a/tests/exception_propagation_3.phpt b/tests/exception_propagation_3.phpt index 622fd3c..bc93c1d 100644 --- a/tests/exception_propagation_3.phpt +++ b/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! diff --git a/v8js_class.cc b/v8js_class.cc index af883ea..01eb2b1 100644 --- a/v8js_class.cc +++ b/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