|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29728 Reflection API Feature: Default parameter value.
Submitted: 2004-08-18 12:05 UTC Modified: 2004-08-19 09:42 UTC
From: wb at pro-net dot co dot uk Assigned: helly (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.1.0-dev OS: *
Private report: No CVE-ID: None
 [2004-08-18 12:05 UTC] wb at pro-net dot co dot uk
This is not strictly a bug and more of a feature request (if there is a better place for feature requests then please let me know).

At the moment there is no way to find out if a parameter for a method has a default value or not.

It would be nice is the ReflectionParameter class had something like the the following methods.

<boolean> ReflectionParameter->isRequired()

Returns TRUE if the parameter is required or FALSE if it is not required (and therefore has a default value).

<mixed> ReflectionParameter->getDefault()

Returns the default value for the parameter. This could throw an Exception if no default value is set as it could be possiable for the default value to be FALSE :)

Reproduce code:

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-19 01:08 UTC]
The first is ReflectionParameter::isOptional()

 [2004-08-19 09:42 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Dec 08 02:03:57 2022 UTC