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