php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28241 Reflection_Parameter needs getDefault()
Submitted: 2004-05-01 11:24 UTC Modified: 2005-03-09 14:09 UTC
From: jevon at jevon dot org Assigned: helly (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.* OS: *
Private report: No CVE-ID: None
 [2004-05-01 11:24 UTC] jevon at jevon dot org
Description:
------------
It would be nice for Reflection_Parameter to have a "getDefault" method to get the default value for the parameter.

Reproduce code:
---------------
class Foo {
  function a($b = 1) { }
}

...

$r = new Reflection_Class("Foo"));
$m = $r->getMethods();
$p = $m[0]->getParameters();
echo "p->getDefault = " . $p->getDefault();

Expected result:
----------------
p->getDefault = 1

Actual result:
--------------
The function doesn't exist
(Fatal error: Call to undefined method reflection_parameter::getDefault())

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-01 11:25 UTC] jevon at jevon dot org
Oops, $p[0]->getDefault() (although this shouldn't affect the logic)
 [2004-05-01 12:20 UTC] helly@php.net
We also then need:
hasDeclaredDefault()
isRequired()

but these will most probably not added before PHP 5.1 because it requires some internal stuctures to change.
 [2004-10-12 09:56 UTC] php at bobsilva dot com
This has been fixed in 5.1 CVS
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Apr 28 12:01:34 2025 UTC