Re: null character - file related function
| From: | Robert Cummings | Date: | Mon, 06 Oct 2003 15:36:04 +0000 |
| Subject: | Re: null character - file related function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165190@lists.php.net to get a copy of this message | ||
On Mon, 2003-10-06 at 11:29, Mark Charette wrote:
> On Mon, 6 Oct 2003, Martin Straka wrote:
> >
> > Is somewhere documented that everything after NULL (0x00 %00) character
> > is ignored for example in functions include, fopen etc?
>
> Interestingly, no, it's not documented in the manual (at least I couldn't
> find any official documentation on NULL terminated strings as a definition
> when I searched through the official docs). However, strings in PHP follow
> the C convention of being NULL terminated.
Strings in PHP are binary safe and thus do not rely on null temrination.
You can see this via the following example:
<?
$foo = "supercalifragi...";
$foo{5} = chr( 0 );
echo $foo{4}."\n";
echo $foo{5}."\n";
echo $foo{6}."\n";
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'