Bug #79652 [NEW]: Wrong ReflectionType for sprintf/printf args parameter

From: Date: Fri, 29 May 2020 17:56:14 +0000
Subject: Bug #79652 [NEW]: Wrong ReflectionType for sprintf/printf args parameter
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227234@lists.php.net to get a copy of this message
From: kukulich at kukulich dot cz Operating system: PHP version: master-Git-2020-05-29 (Git) Package: Reflection related Bug Type: Bug Bug description:Wrong ReflectionType for sprintf/printf args parameter Description: ------------ Wrong ReflectionType for sprintf/printf args parameter. It should return ReflectionUnionType. Test script: --------------- <?php foreach (['sprintf', 'printf'] as $functionName) { $rf = new ReflectionFunction($functionName); $rp = $rf->getParameters()[1]; $rt = $rp->getType(); var_dump($functionName); var_dump($rp->getName()); var_dump($rt::class); if ($rt instanceof ReflectionNamedType) { var_dump($rt->getName()); } var_dump('--------'); } Expected result: ---------------- string(7) "sprintf" string(4) "args" string(19) "ReflectionUnionType" string(8) "--------" string(6) "printf" string(4) "args" string(19) "ReflectionUnionType" string(8) "--------" Actual result: -------------- string(7) "sprintf" string(4) "args" string(19) "ReflectionNamedType" string(39) "object|array|string|int|float|bool|null" string(8) "--------" string(6) "printf" string(4) "args" string(19) "ReflectionNamedType" string(39) "object|array|string|int|float|bool|null" string(8) "--------" -- Edit bug report at https://bugs.php.net/bug.php?id=79652&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79652&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79652&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79652&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79652&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79652&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79652&r=support Expected behavior: https://bugs.php.net/fix.php?id=79652&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79652&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79652&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79652&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79652&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79652&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79652&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79652&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79652&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79652&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79652&r=mysqlcfg

« previous php.bugs (#227234) next »