something wrong with zend_parse_parameters_ex
| From: | Vanilla Hsu | Date: | Fri, 07 Jul 2006 14:33:32 +0000 |
| Subject: | something wrong with zend_parse_parameters_ex | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-3950@lists.php.net to get a copy of this message | ||
Dear Sir:
I try to use zend_parse_parameters_ex to get 2 kind of argument on the
same function.
here is my sample code.
PHP_FUNCTION(vv_test)
{
char *str;
int str_len;
long val;
if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET,
ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == SUCCESS)
{
php_printf ("string: %s, %d", str, str_len);
}
else if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET,
ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == SUCCESS)
{
php_printf ("int: %d", val);
}
else
RETURN_NULL();} when I use <?php vv_test (123); ?> it will print "string: 123, 3"; even I use <?php vv_test (intval (123)); ?> it return the same result. Could someone check this for me? thanks.