Bug #64936 [Opn->Csd]: doc comments picked up from previous scanner run
| From: | stas@php.net | Date: | Sun, 16 Jun 2013 22:29:40 +0000 |
| Subject: | Bug #64936 [Opn->Csd]: doc comments picked up from previous scanner run | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-179584@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64936&edit=1
ID: 64936
Updated by: stas@php.net
Reported by: jonathan at moo dot com
Summary: doc comments picked up from previous scanner run
-Status: Open
+Status: Closed
Type: Bug
Package: Reflection related
PHP Version: master-Git-2013-05-28 (Git)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2208447d428542960c73cfeceaf52e95ff0ca2d0
Log: Fix bug #64936 - clean doc comment state at the beginning and end of the scan
Previous Comments:
------------------------------------------------------------------------
[2013-05-28 12:58:19] jonathan at moo dot com
Description:
------------
The doc_comment compiler global is not reset when scanning of a new file/string
starts. This leads to the last doc_comment seen by the tokenizer, but unclaimed
by anything, being incorrectly assigned to the next thing the compiler sees.
I think that the doc_comment and doc_comment_len globals should probably be
saved/restored by zend_(save|restore)_lexical_state, and reset whenever scanning
for a new file or string starts (pretty much everywhere zend_lineno gets
initialised.)
Test script:
---------------
token_get_all("<?php\n/**\n * Foo\n */"); // doc_comment compiler global now contains
this Foo comment
eval("class Foo { }"); // Could also be an include of a file containing similar
$rc = new ReflectionClass("Foo");
var_dump($rc->getDocComment()); // Foo shouldn't have a doc comment, and yet it does.
Expected result:
----------------
bool(false)
Actual result:
--------------
string(14) "/**\n * Foo\n */"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64936&edit=1