php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63654 ReflectionClass::getConstructor() can return null, not documented
Submitted: 2012-11-30 09:46 UTC Modified: 2012-12-02 05:25 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: benjamin dot morel at strictcoding dot co dot uk Assigned: bjori (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2012-11-30 09:46 UTC] benjamin dot morel at strictcoding dot co dot uk
Description:
------------
The manual for ReflectionClass::getConstructor():
http://www.php.net/manual/en/reflectionclass.getconstructor.php

Documents ReflectionMethod as the only possible return value.

However, as demonstrated in the test script below, this method can return NULL 
when the class has no constructor.

The documentation should be changed to:

Return Values
A ReflectionMethod object reflecting the class' constructor, or NULL if the class 
has no constructor.

Test script:
---------------
class C {}
$r = new ReflectionClass('C');
var_export($r->getConstructor()); // NULL


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-02 05:24 UTC] bjori@php.net
Automatic comment from SVN on behalf of bjori
Revision: http://svn.php.net/viewvc/?view=revision&revision=328599
Log: Fixed #63654    ReflectionClass::getConstructor() can return null, not documented
 [2012-12-02 05:25 UTC] bjori@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2012-12-02 05:25 UTC] bjori@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: bjori
 [2020-02-07 06:08 UTC] phpdocbot@php.net
Automatic comment on behalf of bjori
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=754904a1331945fa729eb1123cf0880ecd0ee4e4
Log: Fixed #63654    ReflectionClass::getConstructor() can return null, not documented
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 07:00:01 2026 UTC