php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48971 Missing ZEND_NS_NAMED_FE macro
Submitted: 2009-07-18 19:42 UTC Modified: 2009-07-28 21:14 UTC
From: mike at mikegerwitz dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.0 OS: GNU/Linux
Private report: No CVE-ID: None
 [2009-07-18 19:42 UTC] mike at mikegerwitz dot com
Description:
------------
PHP 5.3 seems to have missed a few things internally (macro-wise) when it comes to namespaces. When developing an extension for 5.3, I noticed the following:

Zend/zend_API.h:93
#define ZEND_NS_NAMED_FE(ns, zend_name, name, arg_info)

It's blank! I do not see any options to submit patches, therefore, this should be the definition:

#define ZEND_NS_NAMED_FE(ns, zend_name, name, arg_info) \
    ZEND_NS_FENTRY(ns, zend_name, name, arg_info, 0)


In addition, PHP_NS_* aliases are missing for the ZEND_NS_* macros. For example, PHP_FE is an alias to ZEND_FE. Therefore, the following macros should be added:

#define PHP_NS_FE         ZEND_NS_FE
#define PHP_NS_NAMED_FE   ZEND_NS_NAMED_FE
#define PHP_NS_DEP_FE     ZEND_NS_DEP_FE
#define PHP_NS_FALIAS     ZEND_NS_FALIAS
#define PHP_NS_DEP_FALIAS ZEND_NS_DEP_FALIAS

If you could provide me with a means to submit a patch, I would be more than happy to do it myself, as I feel this to be an important (albeit minor) addition for extension developers in order to keep things consistent, and less confusing.

Reproduce code:
---------------
zend_function_entry php_test_functions[] = {
    ZEND_NS_NAMED_FE( "Ns", myfunc, test_myfunc, NULL )
    { NULL, NULL, NULL }
};

---

<?php var_dump( get_extension_funcs('test') ); ?>


Expected result:
----------------
array(1) {
  [0]=>
  string(16) "Ns\myfunc"
}

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

Patches

gaman (last revision 2010-04-12 03:01 UTC by kaka at yahoo dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-28 21:12 UTC] svn@php.net
Automatic comment from SVN on behalf of jani
Revision: http://svn.php.net/viewvc/?view=revision&revision=286469
Log: - Fixed bug #48971 (Missing ZEND_NS_NAMED_FE macro)
 [2009-07-28 21:14 UTC] jani@php.net
Added the missing ZEND_NS_NAMED_FE macro. Adding the aliases for these 
_new_ macros is totally unnecessary. Having those for the old stuff was 
also unnecessary and very confusing to begin with, but that's another 
story..
 [2009-07-28 21:14 UTC] jani@php.net
Short version: ALWAYS use the ZEND_* macros. :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 02:01:29 2024 UTC