php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55156 ReflectionClass::getDocComment() returns comment even though the class has none
Submitted: 2011-07-07 06:46 UTC Modified: 2011-07-07 19:07 UTC
From: schmittjoh at gmail dot com Assigned: felipe (profile)
Status: Closed Package: Reflection related
PHP Version: 5.3.6 OS: Ubuntu 10.04
Private report: No CVE-ID: None
 [2011-07-07 06:46 UTC] schmittjoh at gmail dot com
Description:
------------
In some cases, the ReflectionClass::getDocComment() method returns a doc comment that belongs to another class than the one the ReflectionClass represents.

I haven't been able to reproduce in a isolated script, but instead I have added a failing unit test to Doctrine's unit test suite, see https://github.com/schmittjoh/common/commit/2d77264758ddd9658791b4284a9492a38bb1b049

You can run this test, by performing the following steps:

git clone http://github.com/schmittjoh/common.git
cd common
git checkout strangePhpError
phpunit

Test script:
---------------
see above


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-07 06:50 UTC] schmittjoh at gmail dot com
Note that this only happens if the class that ReflectionClass represents has no doc comment itself.
 [2011-07-07 19:07 UTC] felipe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: felipe
 [2011-07-07 19:07 UTC] felipe@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2011-07-07 19:07 UTC] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=313056
Log: - Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none)
 [2011-08-22 01:11 UTC] pierrick@php.net
Automatic comment from SVN on behalf of pierrick
Revision: http://svn.php.net/viewvc/?view=revision&revision=315259
Log: - Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none)
# Patch was not committed on the PHP5.3 branch
 [2011-10-16 20:03 UTC] karsten at typo3 dot org
I have seen this running PHP 5.3.8, so it seems the fix wasn't complete... I'll 
check with the test mentioned above.
 [2012-02-20 15:09 UTC] kotlyar dot maksim at gmail dot com
I also have such problem while using Doctrine2

My environment:

Ubuntu 11.10
PHP 5.3.6-13ubuntu3.6 with Suhosin-Patch (cli) (built: Feb 11 2012 02:17:16) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

I have fixed it by adding an empty doc block to a class Doctrine complains to.
 [2012-04-18 09:49 UTC] laruence@php.net
Automatic comment on behalf of felipe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=866240200f41560593e2e8958e713f3aa3a03a6c
Log: - Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none)
 [2012-07-24 23:41 UTC] rasmus@php.net
Automatic comment on behalf of felipe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=866240200f41560593e2e8958e713f3aa3a03a6c
Log: - Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none)
 [2013-11-17 09:37 UTC] laruence@php.net
Automatic comment on behalf of felipe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=866240200f41560593e2e8958e713f3aa3a03a6c
Log: - Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC