parsing API "z!" broken

[email protected] ("Pierre Joye")
Newsgroups php.internals.win
Message-ID <[email protected]>
hi,

I met a weird bug yesterday, using "z!" with unset variables works on
unix but fail on windows. For example:

PHP_FUNCTION(foo)
{
	char *a;
	int a_len;
	long b = 0;
	zval *authns = NULL, *addtl = NULL;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz!z!", &a,
&a_len, &b, &c, &d) == FAILURE) {
		return;
	}


case 1:
foo("a", 1, $c, $d);


case 2:
$c = NULL;
$d = NULL;
foo("a", 1, $c, $d);

Case 1: c and d will be a NULL
Case 2: c and d will be valid zval ptr

I did not test yet under 5.3 linux but similar cases work well with 5.2.


Cheers,
--
Pierre

http://blog.thepimp.net | http://www.libgd.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.