Edit report at http://bugs.php.net/bug.php?id=52183&edit=1
ID: 52183 Updated by: [email protected] Reported by: andreas dot streichardt at globalpark dot com Summary: Reflectionfunction reports invalid number of arguments for function aliases Status: Open Type: Bug Package: Reflection related Operating System: Linux PHP Version: 5.3.2 New Comment: To get the arginfo from original function will decrease the performance and will lead to change the internal function structure... I think is better to add the arginfo as the normal functions for the aliases. Previous Comments: ------------------------------------------------------------------------ [2010-06-25 12:50:47] andreas dot streichardt at globalpark dot com Description: ------------ When defining a function alias internally in PHP, PHP_FALIAS requires an arginfo as the third parameter. For example gzwrite() is internally represented as a function alias to fwrite(): PHP_FALIAS(gzwrite, fwrite, NULL) Here however the argument info is not provided. This leads to the fact that the reflection api can't extract the parameters of gzwrite. Why does an FALIAS require an arginfo? Couldn't it just take the argument info of the alias function if the arginfo is null? The impact is that you can't determine the required arguments from the gzwrite function. I hacked the code and added the arginfo stuff and the reflection api immediatly noticed that gzwrite requires 2 parameters. We are doing massive static code analysis and our code analysis returns bogus results due to the fact that the reflection api can't report the real arguments of a function. Test script: --------------- <?php foreach (array("gzwrite","fwrite") as $function) { $refl=new ReflectionFunction($function); var_dump($refl->getNumberOfRequiredParameters()); var_dump($refl->getNumberOfParameters()); } ?> Expected result: ---------------- int(2) int(3) int(2) int(3) Actual result: -------------- int(0) int(0) int(2) int(3) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52183&edit=1
