php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71415 ReflectionClass::__toString is not returning class docblock comment
Submitted: 2016-01-19 20:32 UTC Modified: 2016-01-20 10:56 UTC
From: boris dot momcilovic at gmail dot com Assigned: krakjoe (profile)
Status: Closed Package: Reflection related
PHP Version: 7.0.2 OS: ArchLinux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: boris dot momcilovic at gmail dot com
New email:
PHP Version: OS:

 

 [2016-01-19 20:32 UTC] boris dot momcilovic at gmail dot com
Description:
------------
PHP 7 and newer seem to be stripping class docblock comments when invoked via ReflectionClass::__toString

Test script:
---------------
<?php

/**
 * ClassDocComment
 *
 * @copyright Copyright (c) 2011
 * @author author
 * @see http://php.net
 */
class ClassDocComment {

}

var_dump ((string) new ReflectionClass ('ClassDocComment'));
// or https://3v4l.org/CFHvk

Expected result:
----------------
string(305) "/**
 * ClassDocComment
 *
 * @copyright Copyright (c) 2011
 * @author author
 * @see http://php.net
 */
Class [ &lt;user&gt; class ClassDocComment ] {
  @@ /in/CFHvk 10-12

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [0] {
  }
}
"

Actual result:
--------------
string(203) "
Class [ &lt;user&gt; class ClassDocComment ] {
  @@ /in/CFHvk 10-12

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [0] {
  }
}
"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-20 10:56 UTC] krakjoe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2016-01-20 10:56 UTC] krakjoe@php.net
The fix for this bug has been committed.

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.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 15:01:34 2025 UTC