Re: Referencing constants in extension code

From: Date: Thu, 17 Jan 2008 21:30:12 +0000
Subject: Re: Referencing constants in extension code
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-34821@lists.php.net to get a copy of this message
On 17.01.2008 23:33, Michael B Allen wrote: > This has worked fine Are you really sure? Does valgrind confirm it? > PHP_FUNCTION(foo_status) > { > zval *r; > char *s = ""; > int slen; > struct foo *foo = NULL; > > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!|s!", > &r, &s, &slen) == FAILURE) { > RETURN_FALSE; > } > > if (r) > foo = (struct foo *)zend_fetch_resource(&r TSRMLS_CC, > -1, "foo", NULL, 1, le_foo); > > if (ZEND_NUM_ARGS() > 1) { > foo_status(foo) = s; // save the status for possible retrieval later > } I don't know what "foo_status(foo)" is supposed to mean here, but this code was never supposed to work. You have to copy the string if you want to store it. -- Wbr, Antony Dovgal

« previous php.internals (#34821) next »