Re: substr passing null...

From: Date: Tue, 27 Jan 2009 16:36:08 +0000
Subject: Re: substr passing null...
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-42858@lists.php.net to get a copy of this message
Johannes Schlüter wrote:
I know Ilia recently fixed a few functions that didn't ignore null parameters, but it doesn't appear that substr() was one of them.
I guess that's part of the zend_parse_parameters changes. As we now use the "s" modifier for instance which might better be a "s!". We should certainly spent some time on checking these things. All remember: We're feature freezing, so spend time on finding and fixing bugs instead of adding new ones! :-) (this includes users who can at least report such issues ... )
So this morning I downloaded php5.2-200901271530, php5.3-200901271530, compiled with ./configure --prefix=/home/gnat/php5.{2,3} respectively and then used the following source file to see how they behaved. test.php: <?php $string = 'The String is here'; echo "STRING: $string\n"; echo "SUB".substr($string,3,null)."\n"; echo "END\n"; ?> in both cases the output I get is STRING: The String is here SUB END showing that passing null as the third param for substr is somehow interpreted to mean no length or something. Is this indeed a bug then? and if so where can I submit it? -- Nathanael d. Noblet Gnat Solutions, Inc T: 403.875.4613

« previous php.internals (#42858) next »