I tried the "|!O" and that really hoses things. The | gets processed in zend_parse_va_args and removed (spec is incremented), so that "!O" get sent to zend_parse_arg_impl. Inside of zend_parse_arg_impl, the ! gets set to char c and spec_walk gets incremented which makes the check for the null operator fail and also makes the check for arg type check the ! in the switch case. The result is that "unknown" got sent as the parameter to the function. Not sure if this would be classified as a bug, but it doesn't work for trying to accept a null type hinted parameter in C.
I'll keep playing around with parameter combinations and see what works. Thanks Bob Silva -----Original Message----- From: Marcus Boerger [mailto:[EMAIL PROTECTED] Sent: Thursday, October 27, 2005 12:06 AM To: Bob Silva Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Accept null type hint in C Hello Bob, Thursday, October 27, 2005, 8:51:18 AM, you wrote: > Hi, > Since NULL typehints are allowed in userland, how would I go about it in C? > I have ZEND_ARG_OBJ_INFO(0, obj, ZObject, 1) which has allow null set on. > Then in the method: > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &objA, > pow_ce_ZObject) == FAILURE) { Use "|!O" or "|!o" instead. '!' allows NULL and sets the return value in c-land to NULL. marcus > If I pass NULL, it fails on the grounds that it isn't a ZObject. > Also, > Could someone explain the purpose of the zend_parse_method_parameters > function as opposed to using the zend_parse_parameters? > Thanks > Bob Silva Best regards, Marcus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php