Bug #73632 [Opn->Ver]: Wrong return of ReflectionParameter::getDefaultValueConstantName()
Edit report at https://bugs.php.net/bug.php?id=73632&edit=1
ID: 73632
Updated by: cmb@php.net
Reported by: fishdrowned at gmail dot com
Summary: Wrong return of
ReflectionParameter::getDefaultValueConstantName()
-Status: Open
+Status: Verified
Type: Bug
Package: Reflection related
Operating System: Ubuntu 14.04
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Confirmed: <https://3v4l.org/WqdX9>.
Previous Comments:
------------------------------------------------------------------------
[2016-12-01 06:38:24] fishdrowned at gmail dot com
Description:
------------
ReflectionParameter::getDefaultValueConstantName() returns wrong value in namespace context,
in particular, invocated in a namespace, it returns wrong value for global constants
Test script:
---------------
<?php
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:
----------------
PHP_EOL
SOME_CONSTANT
Actual result:
--------------
Some\Name\Space\PHP_EOL
Some\Name\Space\SOME_CONSTANT
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73632&edit=1
Thread (4 messages)