Skip to content

Commit 3afd98b

Browse files
authored
Merge pull request #331 from stesie/mark-pending-exceptions-deprecated
Mark pending exceptions deprecated
2 parents 07d3df9 + 82930c9 commit 3afd98b

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

tests/exception_clearing.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,17 @@ var_dump($v8->getPendingException());
2121
?>
2222
===EOF===
2323
--EXPECTF--
24+
Deprecated: V8Js::__construct(): Disabling exception reporting is deprecated, $report_uncaught_exceptions != true in %s%eexception_clearing.php on line 3
25+
26+
Deprecated: Function V8Js::getPendingException() is deprecated in %s%eexception_clearing.php on line 5
2427
NULL
28+
29+
Deprecated: Function V8Js::clearPendingException() is deprecated in %s%eexception_clearing.php on line 7
30+
31+
Deprecated: Function V8Js::getPendingException() is deprecated in %s%eexception_clearing.php on line 8
2532
NULL
33+
34+
Deprecated: Function V8Js::getPendingException() is deprecated in %s%eexception_clearing.php on line 11
2635
object(V8JsScriptException)#%d (13) {
2736
["message":protected]=>
2837
string(49) "throw_0:1: ReferenceError: fooobar is not defined"
@@ -73,5 +82,9 @@ object(V8JsScriptException)#%d (13) {
7382
string(57) "ReferenceError: fooobar is not defined
7483
at throw_0:1:1"
7584
}
85+
86+
Deprecated: Function V8Js::clearPendingException() is deprecated in %s%eexception_clearing.php on line 13
87+
88+
Deprecated: Function V8Js::getPendingException() is deprecated in %s%eexception_clearing.php on line 14
7689
NULL
7790
===EOF===

tests/exception_propagation_2.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ try {
3838
?>
3939
===EOF===
4040
--EXPECTF--
41+
Deprecated: V8Js::__construct(): Disabling exception reporting is deprecated, $report_uncaught_exceptions != true in %s%eexception_propagation_2.php on line 8
42+
43+
Deprecated: Function V8Js::getPendingException() is deprecated in %s%eexception_propagation_2.php on line 11
4144
object(V8JsScriptException)#%d (13) {
4245
["message":protected]=>
4346
string(49) "throw_0:1: ReferenceError: fooobar is not defined"

tests/exception_propagation_3.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ try {
3131
}
3232
?>
3333
===EOF===
34-
--EXPECT--
34+
--EXPECTF--
35+
Deprecated: V8Js::__construct(): Disabling exception reporting is deprecated, $report_uncaught_exceptions != true in %s%eexception_propagation_3.php on line 8
3536
SyntaxError caught in JS!
3637
To Bar!
3738
Error caught via PHP callback!

v8js_class.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,10 @@ static PHP_METHOD(V8Js, __construct)
357357
ZVAL_NULL(&c->pending_exception);
358358
c->in_execution = 0;
359359

360+
if (report_uncaught != 1) {
361+
php_error_docref(NULL, E_DEPRECATED, "Disabling exception reporting is deprecated, $report_uncaught_exceptions != true");
362+
}
363+
360364
new (&c->create_params) v8::Isolate::CreateParams();
361365

362366
#ifdef USE_INTERNAL_ALLOCATOR
@@ -1265,8 +1269,8 @@ const zend_function_entry v8js_methods[] = { /* {{{ */
12651269
PHP_ME(V8Js, compileString, arginfo_v8js_compilestring, ZEND_ACC_PUBLIC)
12661270
PHP_ME(V8Js, executeScript, arginfo_v8js_executescript, ZEND_ACC_PUBLIC)
12671271
PHP_ME(V8Js, checkString, arginfo_v8js_checkstring, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
1268-
PHP_ME(V8Js, getPendingException, arginfo_v8js_getpendingexception, ZEND_ACC_PUBLIC)
1269-
PHP_ME(V8Js, clearPendingException, arginfo_v8js_clearpendingexception, ZEND_ACC_PUBLIC)
1272+
PHP_ME(V8Js, getPendingException, arginfo_v8js_getpendingexception, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
1273+
PHP_ME(V8Js, clearPendingException, arginfo_v8js_clearpendingexception, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
12701274
PHP_ME(V8Js, setModuleNormaliser, arginfo_v8js_setmodulenormaliser, ZEND_ACC_PUBLIC)
12711275
PHP_ME(V8Js, setModuleLoader, arginfo_v8js_setmoduleloader, ZEND_ACC_PUBLIC)
12721276
PHP_ME(V8Js, setTimeLimit, arginfo_v8js_settimelimit, ZEND_ACC_PUBLIC)

0 commit comments

Comments
 (0)