xref: /PHP-7.4/ext/reflection/tests/bug64936.phpt (revision a920db8f)
1--TEST--
2ReflectionMethod::getDocComment() uses left over doc comment from previous scanner run
3--SKIPIF--
4<?php if (!extension_loaded('tokenizer')) die('skip tokenizer extension not loaded'); ?>
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===DONE===
32--EXPECT--
33bool(false)
34bool(false)
35===DONE===
36