xref: /PHP-8.1/ext/reflection/tests/bug38653.phpt (revision f8d79582)
1--TEST--
2Bug #38653 (memory leak in ReflectionClass::getConstant())
3--FILE--
4<?php
5
6class foo {
7        const cons = 10;
8        const cons1 = "";
9        const cons2 = "test";
10}
11
12class bar extends foo {
13}
14
15$foo = new ReflectionClass("foo");
16var_dump($foo->getConstant("cons"));
17var_dump($foo->getConstant("cons1"));
18var_dump($foo->getConstant("cons2"));
19var_dump($foo->getConstant("no such const"));
20
21echo "Done\n";
22?>
23--EXPECT--
24int(10)
25string(0) ""
26string(4) "test"
27bool(false)
28Done
29