Bug #73632 [NEW]: Wrong return of ReflectionParameter::getDefaultValueConstantName()
| From: | fishdrowned at gmail dot com | Date: | Thu, 01 Dec 2016 06:38:27 +0000 |
| Subject: | Bug #73632 [NEW]: Wrong return of ReflectionParameter::getDefaultValueConstantName() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-205705@lists.php.net to get a copy of this message | ||
From: fishdrowned at gmail dot com
Operating system: Ubuntu 14.04
PHP version: Irrelevant
Package: Reflection related
Bug Type: Bug
Bug description:Wrong return of ReflectionParameter::getDefaultValueConstantName()
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 bug report at https://bugs.php.net/bug.php?id=73632&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73632&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73632&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73632&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73632&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73632&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73632&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73632&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73632&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73632&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73632&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73632&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73632&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73632&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73632&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73632&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73632&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73632&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73632&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73632&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73632&r=mysqlcfg