|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69249 ReflectionProperty::getDocComment() non catchable fatal
Submitted: 2015-03-17 15:03 UTC Modified: 2018-07-02 18:21 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: bkfake-php at yahoo dot com Assigned: nikic (profile)
Status: Closed Package: Reflection related
PHP Version: 5.6.7 OS: Win7 x64
Private report: No CVE-ID: None
 [2015-03-17 15:03 UTC] bkfake-php at yahoo dot com
Calling ReflectionProperty::getDocComment() on a property that hasn't been declared in the class "core dumps". 

Simply returning null, false, or an empty string would be much more user friendly

To safely call ReflectionProperty::getDocComment(), you must first check if the property exists in the class
$docComment = property_exists('Test', $prop->getName())
    ? $prop->getDocComment()
    : '';

Test script:
$obj = new Test();
$obj->notDeclared = 'Not defined in class';

$reflectionObject = new \ReflectionObject($obj);
$properties = $reflectionObject->getProperties();

while ($properties) {
    $prop = array_shift($properties);

 * Test
class Test
    // properties and methods...

Expected result:
script completes

Actual result:
Apache restarts


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-18 02:50 UTC]
-Status: Open +Status: Feedback
 [2015-03-18 02:50 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read for *NIX and for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

 [2015-03-24 17:07 UTC] bkfake-php at yahoo dot com
-Status: Feedback +Status: Open -PHP Version: 5.6.6 +PHP Version: 5.6.7
 [2015-03-24 17:07 UTC] bkfake-php at yahoo dot com
let me know if this isn't the backtrace information you're looking for

In httpd__PID__3192__Date__03_24_2015__Time_11_51_07AM__420__Second_Chance_Exception_C0000005.dmp the assembly instruction at msvcr110!memcpy+21e in C:\Windows\System32\msvcr110.dll from Microsoft Corporation has caused an access violation exception (0xC0000005) when trying to read from memory location 0x00000000 on thread 64

here's thread 64
Thread 64 - System ID 8012

Entry point   libhttpd!ap_regkey_value_set+1bf0 
Create time   3/24/2015 11:43:25 AM 
Time spent in user mode   0 Days 00:00:00.000 
Time spent in kernel mode   0 Days 00:00:00.000 

This thread is not fully resolved and may or may not be a problem. Further analysis of these threads may be required.


 [2018-07-02 18:21 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2018-07-02 18:21 UTC]
Can't reproduce this on any supported PHP version (getDocComment() returns false), so I'm assuming this is fixed.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed May 31 11:03:37 2023 UTC