File tree 4 files changed +142
-0
lines changed 4 files changed +142
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #48228 (crash when exception is thrown while passing function arguments)
3
+ --FILE--
4
+ <?
5
+
6
+ function do_throw () {
7
+ throw new Exception ();
8
+ }
9
+
10
+ class aa
11
+ {
12
+ function check ()
13
+ {
14
+ }
15
+
16
+ function dosome ()
17
+ {
18
+ $ this ->check (do_throw ());
19
+ }
20
+ }
21
+ $ l_aa =new aa ();
22
+
23
+ $ l_aa ->dosome ();
24
+ ?>
25
+ --EXPECTF--
26
+
27
+ Fatal error: Uncaught exception 'Exception' in %s
28
+ Stack trace:
29
+ #0 %s(%d): do_throw()
30
+ #1 %s(%d): aa->dosome()
31
+ #2 {main}
32
+ thrown in %s
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #48408 (crash when exception is thrown while passing function arguments)
3
+ --FILE--
4
+ <?php
5
+ class B{
6
+ public function process ($ x ){
7
+ return $ x ;
8
+ }
9
+ }
10
+ class C{
11
+ public function generate ($ x ){
12
+ throw new Exception ;
13
+ }
14
+ }
15
+ $ b = new B ;
16
+ $ c = new C ;
17
+ try {
18
+ $ b ->process ($ c ->generate (0 ));
19
+ }
20
+ catch (Exception $ e ){
21
+ $ c ->generate (0 );
22
+ }
23
+ ?>
24
+ --EXPECTF--
25
+
26
+ Fatal error: Uncaught exception 'Exception' in %s
27
+ Stack trace:
28
+ #0 %s(%d): C->generate(0)
29
+ #1 {main}
30
+ thrown in %s
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #48409 (crash when exception is thrown while passing function arguments)
3
+ --FILE--
4
+ <?php
5
+
6
+ class ABCException extends Exception {}
7
+
8
+ class BBB
9
+ {
10
+ public function xyz ($ d , $ x )
11
+ {
12
+ if ($ x == 34 ) {
13
+ throw new ABCException ;
14
+ }
15
+ return array ('foo ' => 'xyz ' );
16
+ }
17
+ }
18
+
19
+ class CCC
20
+ {
21
+ public function process ($ p )
22
+ {
23
+ return $ p ;
24
+ }
25
+ }
26
+
27
+ class AAA
28
+ {
29
+ public function func ()
30
+ {
31
+ $ b = new BBB ;
32
+ $ c = new CCC ;
33
+ $ i = 34 ;
34
+ $ item = array ('foo ' => 'bar ' );
35
+ try {
36
+ $ c ->process ($ b ->xyz ($ item ['foo ' ], $ i ));
37
+ }
38
+ catch (ABCException $ e ) {
39
+ $ b ->xyz ($ item ['foo ' ], $ i );
40
+ }
41
+ } // end func();
42
+ }
43
+
44
+ class Runner
45
+ {
46
+ public function run ($ x )
47
+ {
48
+ try {
49
+ $ x ->func ();
50
+ }
51
+ catch (ABCException $ e ) {
52
+ throw new Exception ;
53
+ }
54
+ }
55
+ }
56
+
57
+ try {
58
+ $ runner = new Runner ;
59
+ $ runner ->run (new AAA );
60
+ }
61
+ catch (Exception $ e ) {
62
+ die ('Exception thrown ' );
63
+ }
64
+
65
+ ?>
66
+ --EXPECT--
67
+ Exception thrown
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #48428 (crash when exception is thrown while passing function arguments)
3
+ --FILE--
4
+ <?php
5
+ try {
6
+ function x () { throw new Exception ("ERROR " ); }
7
+ x (x ());
8
+ } catch (Exception $ e ) {
9
+ echo ($ e -> getMessage ());
10
+ }
11
+ ?>
12
+ --EXPECT--
13
+ ERROR
You can’t perform that action at this time.
0 commit comments