File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Test V8::setExceptionFilter() : Uninstall filter on NULL
3
+ --SKIPIF--
4
+ <?php require_once (dirname (__FILE__ ) . '/skipif.inc ' ); ?>
5
+ --FILE--
6
+ <?php
7
+ class myv8 extends V8Js
8
+ {
9
+ public function throwException (string $ message ) {
10
+ throw new Exception ($ message );
11
+ }
12
+ }
13
+
14
+ $ v8 = new myv8 ();
15
+ $ v8 ->setExceptionFilter (function (Throwable $ ex ) {
16
+ echo "exception filter called. \n" ;
17
+ return "moep " ;
18
+ });
19
+
20
+ $ v8 ->executeString ('
21
+ try {
22
+ PHP.throwException("Oops");
23
+ }
24
+ catch (e) {
25
+ var_dump(e);
26
+ }
27
+ ' , null , V8Js::FLAG_PROPAGATE_PHP_EXCEPTIONS );
28
+
29
+ $ v8 ->setExceptionFilter (null );
30
+
31
+ try {
32
+ $ v8 ->executeString ('
33
+ try {
34
+ PHP.throwException("Oops");
35
+ print("done \\n");
36
+ }
37
+ catch (e) {
38
+ print("caught \\n");
39
+ var_dump(e.getMessage());
40
+ }
41
+ ' , null , V8Js::FLAG_PROPAGATE_PHP_EXCEPTIONS );
42
+ } catch (Exception $ ex ) {
43
+ echo "caught in php: " . $ ex ->getMessage () . PHP_EOL ;
44
+ }
45
+
46
+ ?>
47
+ ===EOF===
48
+ --EXPECT--
49
+ exception filter called.
50
+ string(4) "moep"
51
+ caught
52
+ string(4) "Oops"
53
+ ===EOF===
You can’t perform that action at this time.
0 commit comments