|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23215 strstr does not return return all from found needle to the end of the string
Submitted: 2003-04-14 20:24 UTC Modified: 2003-04-14 22:04 UTC
From: gorkha at brillianet dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.0 OS: linux redhat 8.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: gorkha at brillianet dot com
New email:
PHP Version: OS:


 [2003-04-14 20:24 UTC] gorkha at brillianet dot com
Example of the bug:

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-14 22:04 UTC]
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:


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'.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Jun 01 22:03:39 2023 UTC