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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 20:01:30 2024 UTC