|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60572 Can't make a optional callback arguments in extension
Submitted: 2011-12-20 09:52 UTC Modified: 2011-12-20 13:51 UTC
From: Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.8 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2011-12-20 09:52 UTC]
following codes in extension didn't work as expected:
 zend_fcall_info fci = {0};
 zend_fcall_info_cache fci_cache;
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|f", &key, &klen, 
&fci, &fci_cache) {

    if (!fci.size) {   
       // not a valid callback

in PHP script:

php_ext_function("name", NULL);  

result in:
argument 2 not a valid callback...  

I haved tried set the arginfo with all_null.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-20 13:17 UTC]
-Status: Open +Status: Bogus
 [2011-12-20 13:17 UTC]
Optional means "accepting the argument was not given", not "accepting a NULL". To accept NULLs, you have to use !, otherwise the argument is coerced to whatever type you're expecting, which is not possible here.


if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|f!", &key, &klen, 
&fci, &fci_cache) {
 [2011-12-20 13:51 UTC]
ah, thanks cataphract.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 08:01:27 2024 UTC