xref: /PHP-8.2/ext/reflection/tests/bug51911.phpt (revision f3009cb5)
1--TEST--
2Bug #51911 (ReflectionParameter::getDefaultValue() memory leaks with constant array)
3--FILE--
4<?php
5
6class Foo {
7   const X = 1;
8   public function x($x = array(1)) {}
9}
10
11$clazz = new ReflectionClass('Foo');
12$method = $clazz->getMethod('x');
13foreach ($method->getParameters() as $param) {
14    if ( $param->isDefaultValueAvailable())
15        echo '$', $param->getName(), ' : ', var_export($param->getDefaultValue(), 1), "\n";
16}
17
18?>
19--EXPECT--
20$x : array (
21  0 => 1,
22)
23