From:
Operating system: FreeBSD 8.0
PHP version: 5.3.3
Package: Reflection related
Bug Type: Bug
Bug description:ReflectionMethod::getParameters() return incorrect number of
arguments
Description:
------------
I'm using PHP 5.3.3 and PHP trunk under FreeBSD 8.0 p4.
I'm trying to retrieve arguments of phar::__construct() with
ReflectionMethod::getArguments().
Phar::__construct() take only 3 arguments, but my script return 4
arguments, as if PharData::__construct() was used instead of
Phar::__construct() by the reflection API.
In fact, ext/phar_object.c contains the following comments :
/* {{{ proto void Phar::__construct(string fname [, int flags [, string
alias]])
* Construct a Phar archive object
* {{{ proto void PharData::__construct(string fname [[, int flags [,
string alias]], int file format = Phar::TAR])
* Construct a PharData archive object
*/
PHP_METHOD(Phar, __construct)
{
...
}
Test script:
---------------
<?php
$method = new reflectionMethod('phar', '__construct');
foreach ($method->getParameters() as $parameter)
{
var_dump($parameter->getName());
var_dump($parameter->isOptional());
var_dump($parameter->isDefaultValueAvailable());
}
?>
Expected result:
----------------
string(8) "filename"
bool(false)
bool(false)
string(5) "flags"
bool(true)
bool(false)
string(5) "alias"
bool(true)
bool(false)
Actual result:
--------------
string(8) "filename"
bool(false)
bool(false)
string(5) "flags"
bool(true)
bool(false)
string(5) "alias"
bool(true)
bool(false)
string(10) "fileformat"
bool(true)
bool(false)
--
Edit bug report at http://bugs.php.net/bug.php?id=52909&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52909&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52909&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52909&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52909&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52909&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52909&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52909&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52909&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52909&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52909&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52909&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52909&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52909&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52909&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52909&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52909&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52909&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52909&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52909&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52909&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52909&r=mysqlcfg