Re: [PHP-DEV] Referencing constants in extension code

2008-01-22 Thread Richard Lynch
On Fri, January 18, 2008 1:08 am, Antony Dovgal wrote: > On 18.01.2008 04:39, Michael B Allen wrote: >>> You have to copy the string if you want to store it. >> >> Ok. Doesn't look like I have much choice. I just wanted to >> understand >> the problem better. I'll just copy the strings. >> >> But i

Re: [PHP-DEV] Referencing constants in extension code

2008-01-17 Thread Antony Dovgal
On 18.01.2008 10:33, Michael B Allen wrote: >> Because you have to copy something that is going to be freed by PHP. >> That's how it works & worked for ages - you don't have to free the >> strings you get from zend_parse_parameters() because PHP does it for you. > > I newer versions of zend engin

Re: [PHP-DEV] Referencing constants in extension code

2008-01-17 Thread Michael B Allen
On 1/18/08, Antony Dovgal <[EMAIL PROTECTED]> wrote: > On 18.01.2008 04:39, Michael B Allen wrote: > >> You have to copy the string if you want to store it. > > > > Ok. Doesn't look like I have much choice. I just wanted to understand > > the problem better. I'll just copy the strings. > > > > But

Re: [PHP-DEV] Referencing constants in extension code

2008-01-17 Thread Antony Dovgal
On 18.01.2008 04:39, Michael B Allen wrote: >> You have to copy the string if you want to store it. > > Ok. Doesn't look like I have much choice. I just wanted to understand > the problem better. I'll just copy the strings. > > But it does seem odd to me that PHP does not always reference string

Re: [PHP-DEV] Referencing constants in extension code

2008-01-17 Thread Michael B Allen
On 1/17/08, Antony Dovgal <[EMAIL PROTECTED]> wrote: > On 17.01.2008 23:33, Michael B Allen wrote: > > This has worked fine > > Are you really sure? It has worked just fine under load in production with PHP 5, 5.0 and 5.1. It *seems* there's something different about 5.2. > Does valgrind confirm

Re: [PHP-DEV] Referencing constants in extension code

2008-01-17 Thread Antony Dovgal
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!",

[PHP-DEV] Referencing constants in extension code

2008-01-17 Thread Michael B Allen
Hi, It seems something has changed recently regarding referencing constants that has broken my extension and I'm trying to figure out exactly what the right thing to do is. When passing a string constant to an extension function, within the extension I have been saving that string directly for po