From:             jonathan at moo dot com
Operating system: 
PHP version:      master-Git-2013-05-28 (Git)
Package:          Reflection related
Bug Type:         Bug
Bug description:doc comments picked up from previous scanner run

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 bug report at https://bugs.php.net/bug.php?id=64936&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64936&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64936&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64936&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64936&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64936&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64936&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64936&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64936&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64936&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64936&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64936&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64936&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64936&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64936&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64936&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64936&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64936&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64936&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64936&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64936&r=mysqlcfg

Reply via email to