xref: /php-src/ext/reflection/tests/bug33389.phpt (revision f34114b1)
1--TEST--
2Reflection Bug #33389 (double free() when exporting a ReflectionClass)
3--FILE--
4<?php
5define ('foobar', 1);
6class Test {
7    function foo1($arg=foobar) {
8    }
9    function foo2($arg=null) {
10    }
11    function foo3($arg=false) {
12    }
13    function foo4($arg='foo') {
14    }
15    function foo5($arg=1) {
16    }
17    function bar($arg) {
18    }
19    function foo() {
20    }
21}
22echo new ReflectionClass('Test');
23?>
24--EXPECTF--
25Class [ <user> class Test ] {
26  @@ %sbug33389.php 3-18
27
28  - Constants [0] {
29  }
30
31  - Static properties [0] {
32  }
33
34  - Static methods [0] {
35  }
36
37  - Properties [0] {
38  }
39
40  - Methods [7] {
41    Method [ <user> public method foo1 ] {
42      @@ %sbug33389.php 4 - 5
43
44      - Parameters [1] {
45        Parameter #0 [ <optional> $arg = foobar ]
46      }
47    }
48
49    Method [ <user> public method foo2 ] {
50      @@ %sbug33389.php 6 - 7
51
52      - Parameters [1] {
53        Parameter #0 [ <optional> $arg = NULL ]
54      }
55    }
56
57    Method [ <user> public method foo3 ] {
58      @@ %sbug33389.php 8 - 9
59
60      - Parameters [1] {
61        Parameter #0 [ <optional> $arg = false ]
62      }
63    }
64
65    Method [ <user> public method foo4 ] {
66      @@ %sbug33389.php 10 - 11
67
68      - Parameters [1] {
69        Parameter #0 [ <optional> $arg = 'foo' ]
70      }
71    }
72
73    Method [ <user> public method foo5 ] {
74      @@ %sbug33389.php 12 - 13
75
76      - Parameters [1] {
77        Parameter #0 [ <optional> $arg = 1 ]
78      }
79    }
80
81    Method [ <user> public method bar ] {
82      @@ %sbug33389.php 14 - 15
83
84      - Parameters [1] {
85        Parameter #0 [ <required> $arg ]
86      }
87    }
88
89    Method [ <user> public method foo ] {
90      @@ %sbug33389.php 16 - 17
91    }
92  }
93}
94