xref: /PHP-8.1/ext/reflection/tests/bug64936.phpt (revision 74859783)
1--TEST--
2ReflectionMethod::getDocComment() uses left over doc comment from previous scanner run
3--EXTENSIONS--
4tokenizer
5--INI--
6opcache.save_comments=1
7--FILE--
8<?php
9
10function strip_doc_comment($c)
11{
12    if (!strlen($c) || $c === false) return $c;
13    return trim(substr($c, 3, -2));
14}
15
16token_get_all("<?php\n/**\n * Foo\n */"); // doc_comment compiler global now contains this Foo comment
17
18eval('class A { }'); // Could also be an include of a file containing similar
19
20$ra = new ReflectionClass('A');
21var_dump(strip_doc_comment($ra->getDocComment()));
22
23token_get_all("<?php\n/**\n * Foo\n */"); // doc_comment compiler global now contains this Foo comment
24
25include('bug64936.inc');
26
27$rb = new ReflectionClass('B');
28var_dump(strip_doc_comment($rb->getDocComment()));
29
30?>
31--EXPECT--
32bool(false)
33bool(false)
34