Edit report at https://bugs.php.net/bug.php?id=60572&edit=1

 ID:                 60572
 Updated by:         larue...@php.net
 Reported by:        larue...@php.net
 Summary:            Can't make a optional callback arguments in
                     extension
 Status:             Bogus
 Type:               Bug
 Package:            *General Issues
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

ah, thanks cataphract.


Previous Comments:
------------------------------------------------------------------------
[2011-12-20 13:17:38] cataphr...@php.net

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) {

------------------------------------------------------------------------
[2011-12-20 09:52:59] larue...@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.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60572&edit=1

Reply via email to