|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52183 Reflectionfunction reports invalid number of arguments for function aliases
Submitted: 2010-06-25 12:50 UTC Modified: 2010-06-26 18:04 UTC
From: andreas dot streichardt at globalpark dot com Assigned: felipe (profile)
Status: Closed Package: Reflection related
PHP Version: 5.3.2 OS: Linux
Private report: No CVE-ID: None
 [2010-06-25 12:50 UTC] andreas dot streichardt at globalpark dot com
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:
foreach (array("gzwrite","fwrite") as $function)
  $refl=new ReflectionFunction($function);

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-26 17:27 UTC]
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.
 [2010-06-26 18:03 UTC]
Automatic comment from SVN on behalf of felipe
Log: - Fixed bug #52183 (Reflectionfunction reports invalid number of arguments for function aliases)
 [2010-06-26 18:04 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: felipe
 [2010-06-26 18:04 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 02:01:29 2024 UTC