php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47058 ReflectionFunction::getParameters() retuns null
Submitted: 2009-01-09 20:48 UTC Modified: 2009-01-09 21:54 UTC
From: zoe@php.net Assigned:
Status: Not a bug Package: Reflection related
PHP Version: 5.2.8 OS: Linux and Windows
Private report: No CVE-ID: None
 [2009-01-09 20:48 UTC] zoe@php.net
Description:
------------
ReflectionFunction::getParameters() returns an empty array for some (not all) functions which have parameters.

This feature works correctly in PHP53, as far as I can tell the code to make it work was added on 11/08/2008 by cseiler, there is no bug reference in the CVS comment so I don't think this is a duplicate, apologies if there is and I have failed to find it.

Reproduce code:
---------------
http://pastebin.ca/1304533

Note: PHP needs to be built with zlib to run this.

Expected result:
----------------
As shown in the test case above

Actual result:
--------------
array(0) {
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-09 21:54 UTC] felipe@php.net
Hi Zoe, this is expected. As of 5.3 we have added all missing arginfo for all ext/*, then we have:

ZEND_BEGIN_ARG_INFO_EX(arginfo_gzopen, 0, 0, 2)
	ZEND_ARG_INFO(0, filename)
	ZEND_ARG_INFO(0, mode)
	ZEND_ARG_INFO(0, use_include_path)
ZEND_END_ARG_INFO()

That helps reflection to know about the param name, number of parameters, if the param(s) is/are by ref.

Prior 5.3, few extensions did make use of the arginfo (the ZEND_BEGIN_ARG_INFO_EX stuff).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC