#23215 [Opn->Bgs]: strstr does not return return all from found needle to the end of the string

From: Date: Tue, 15 Apr 2003 03:04:01 +0000
Subject: #23215 [Opn->Bgs]: strstr does not return return all from found needle to the end of the string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37681@lists.php.net to get a copy of this message
ID: 23215 Updated by: pollita@php.net Reported By: gorkha at brillianet dot com -Status: Open +Status: Bogus Bug Type: Strings related Operating System: linux redhat 8.0 PHP Version: 4.3.0 New Comment: Please double check both your PHP version and your test script. strstr() is binary safe in PHP 4.3.0 Local test with your exact script returns: ohnSmith Additionally, var_dump(strstr($teststring,"oh")); returns: string(9) "ohnSmith" which reveals the hidden (non-printing) null character. If you have additional information which can lead to the reproduction of this bug, please feel free to add it here and reclassify the bug to 'open'. Previous Comments: ------------------------------------------------------------------------ [2003-04-14 20:24:20] gorkha at brillianet dot com Example of the bug: $teststring="John\0Smith"; print strstr($teststring,"oh"); It will now only print out 'ohn', because strstr only returns to the '\0' and not the rest of the string. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23215&edit=1

« previous php.bugs (#37681) next »