xref: /PHP-7.4/ext/reflection/tests/bug33389.phpt (revision 3121b717)
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--EXPECTF--
24Class [ <user> class Test ] {
25  @@ %sbug33389.php 3-18
26
27  - Constants [0] {
28  }
29
30  - Static properties [0] {
31  }
32
33  - Static methods [0] {
34  }
35
36  - Properties [0] {
37  }
38
39  - Methods [7] {
40    Method [ <user> public method foo1 ] {
41      @@ %sbug33389.php 4 - 5
42
43      - Parameters [1] {
44        Parameter #0 [ <optional> $arg = 1 ]
45      }
46    }
47
48    Method [ <user> public method foo2 ] {
49      @@ %sbug33389.php 6 - 7
50
51      - Parameters [1] {
52        Parameter #0 [ <optional> $arg = NULL ]
53      }
54    }
55
56    Method [ <user> public method foo3 ] {
57      @@ %sbug33389.php 8 - 9
58
59      - Parameters [1] {
60        Parameter #0 [ <optional> $arg = false ]
61      }
62    }
63
64    Method [ <user> public method foo4 ] {
65      @@ %sbug33389.php 10 - 11
66
67      - Parameters [1] {
68        Parameter #0 [ <optional> $arg = 'foo' ]
69      }
70    }
71
72    Method [ <user> public method foo5 ] {
73      @@ %sbug33389.php 12 - 13
74
75      - Parameters [1] {
76        Parameter #0 [ <optional> $arg = 1 ]
77      }
78    }
79
80    Method [ <user> public method bar ] {
81      @@ %sbug33389.php 14 - 15
82
83      - Parameters [1] {
84        Parameter #0 [ <required> $arg ]
85      }
86    }
87
88    Method [ <user> public method foo ] {
89      @@ %sbug33389.php 16 - 17
90    }
91  }
92}
93