Re: [PHP-DEV] Programming question

2001-08-07 Thread Daniel Cowgill
> On Thu, Aug 02, 2001 at 12:24:03PM -0400, George Schlossnagle > wrote: > > On a related note, placing null-bytes in the middle of strings > > (for example > > in the names of the so-called lambda_functions generated from > > create_function()) seems like a pretty questionable practice. > >

Re: [PHP-DEV] Programming question

2001-08-07 Thread George Schlossnagle
Right now, the zend_function struct contains a char *function_name but no int function_name_len. In light of the comments below, I think this is a bug, or a bug waiting to happen. George > If the string functions (str*()) don't work with function names in PHP, > it's all for the better. Code t

Re: [PHP-DEV] Programming question

2001-08-03 Thread George Schlossnagle
lt;[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, August 02, 2001 12:18 PM Subject: Re: [PHP-DEV] Programming question > > can it be assumed that > > zval.str.val[zval.str.len] = '\0'? > > > > i.e., the byte after the string in a zval is t

Re: [PHP-DEV] Programming question

2001-08-03 Thread Thies C. Arntzen
On Thu, Aug 02, 2001 at 09:18:40AM -0700, Rasmus Lerdorf wrote: > > can it be assumed that > > zval.str.val[zval.str.len] = '\0'? > > > > i.e., the byte after the string in a zval is the null-byte? > > > > That is assumed in various places in ext/standard/string.c, and AFAIK > > that may not alway

Re: [PHP-DEV] Programming question

2001-08-03 Thread Rasmus Lerdorf
> can it be assumed that > zval.str.val[zval.str.len] = '\0'? > > i.e., the byte after the string in a zval is the null-byte? > > That is assumed in various places in ext/standard/string.c, and AFAIK > that may not always be true. No code in PHP should assume this. PHP should always check the le

Re: [PHP-DEV] Programming question

2001-08-03 Thread Zeev Suraski
If the string functions (str*()) don't work with function names in PHP, it's all for the better. Code that works with these function names should only be using mem*() functions anyway, they're quicker and they're binary safe. Zeev At 10:22 02/08/2001, George Schlossnagle wrote: > > > It seem

Re: [PHP-DEV] Programming question

2001-08-03 Thread Zeev Suraski
Actually, any code in PHP can assume this. Any zval coming from the engine is NULL terminated, so zval.str.val[zval.str.len] is always NULL. Obviously, if you create the string, you have to NULL terminate it before you can assume that :) If a string is not NULL terminated, it is a bug. At 09

Re: [PHP-DEV] Programming question

2001-08-02 Thread Thies C. Arntzen
On Thu, Aug 02, 2001 at 12:24:03PM -0400, George Schlossnagle wrote: > On a related note, placing null-bytes in the middle of strings > (for example > in the names of the so-called lambda_functions generated from > create_function()) seems like a pretty questionable practice. why, this makes