|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2011-12-20 09:52 UTC] laruence@php.net
 Description:
------------
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) {
         return;
     }
    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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 07:00:01 2025 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. so if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|f!", &key, &klen, &fci, &fci_cache) {