Re: Programming question
| From: | Thies C. Arntzen | Date: | Thu, 02 Aug 2001 16:25:47 +0000 |
| Subject: | Re: Programming question | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-61842@lists.php.net to get a copy of this message | ||
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 always be true.
>
> No code in PHP should assume this. PHP should always check the length.
> However, many external libraries that take string arguments are not going
> to be able to check our length property and we therefore should strive to
> null-terminate all strings. I noticed Thies has been going through
> recently and cleaning this up a bit.
in debug mode php will also trow a warning if it finds a not
zero-terminated string during execution.
tc