|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73632 Wrong return of ReflectionParameter::getDefaultValueConstantName()
Submitted: 2016-12-01 06:38 UTC Modified: 2016-12-01 17:14 UTC
Avg. Score:3.7 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: fishdrowned at gmail dot com Assigned:
Status: Verified Package: Reflection related
PHP Version: Irrelevant OS: Ubuntu 14.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: fishdrowned at gmail dot com
New email:
PHP Version: OS:


 [2016-12-01 06:38 UTC] fishdrowned at gmail dot com
ReflectionParameter::getDefaultValueConstantName() returns wrong value in namespace context,
in particular, invocated in a namespace, it returns wrong value for global constants

Test script:
namespace {

    define('SOME_CONSTANT', 1);

namespace Some\Name\Space {

    use ReflectionFunction;

    $reflection = new ReflectionFunction(function ($const = PHP_EOL, $const2 = SOME_CONSTANT) {
    echo $reflection->getParameters()[0]->getDefaultValueConstantName() . PHP_EOL;
    echo $reflection->getParameters()[1]->getDefaultValueConstantName() . PHP_EOL;

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-01 17:14 UTC]
-Status: Open +Status: Verified
 [2016-12-01 17:14 UTC]
Confirmed: <>.
 [2018-02-11 18:38 UTC] carusogabriel34 at gmail dot com
This an addendum: if the constant is root namespaced, it works!
 [2023-04-11 11:49 UTC] bloginteriorhome at gmail dot com
Home Create Designs are sharing latest news about home improvement, gadening, decoration, design, renovate, real estate etc. More info to visit: (
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 00:01:31 2024 UTC