note 29488 deleted from function.strstr by sobak
| From: | sobak@php.net | Date: | Fri, 25 Nov 2016 05:11:38 +0000 |
| Subject: | note 29488 deleted from function.strstr by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207616@lists.php.net to get a copy of this message | ||
Note Submitter: php at silisoftware dot com
----
PHP versions before 4.3.0 (tested on 4.2.2 and 4.2.3) return the $haystack from $needle only up to
the first null character. So for example:
<?php
$string = strstr("one#two\x00three", "#");
// PHP 4.2.x: $string contains "#two"
// PHP 4.3.0: $string contains "#two\x00three"
?>
If you're trying to match nulls, you will probably get back an empty string:
<?php
$string = strstr("one#two\x00three", "\x00");
// PHP 4.2.x: $string contains ""
// PHP 4.3.0: $string contains "\x00three"
?>