php.net |  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: 2015-03-24 17:07 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: bkfake-php at yahoo dot com Assigned:
Status: Open Package: Reflection related
PHP Version: 5.6.7 OS: Win7 x64
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-03-17 15:03 UTC] bkfake-php at yahoo dot com
Description:
------------
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);
    $prop->getDocComment();
}

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

Expected result:
----------------
script completes


Actual result:
--------------
Apache restarts

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-18 02:50 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2015-03-18 02:50 UTC] laruence@php.net
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
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php 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.



Function

msvcr110!memcpy+21e 
php5ts!estrndup+30 
php5ts!zend_reflection_class_factory+b50f 
php5ts!execute_ex+cb1 
php5ts!instanceof_function+3c7 
php5ts!execute_ex+3b4 
php5ts!zend_execute+22c 
php5ts!zend_execute+1ca 
php5ts!zend_execute_scripts+14b 
php5ts!php_execute_script+1b4
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sat Jun 24 02:01:42 2017 UTC