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