|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #757 strpos is not binary save
Submitted: 1998-09-18 10:46 UTC Modified: 1998-09-18 11:05 UTC
From: thies at digicol dot de Assigned:
Status: Closed Package: Other
PHP Version: 3.0 Latest CVS OS: all
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: thies at digicol dot de
New email:
PHP Version: OS:


 [1998-09-18 10:46 UTC] thies at digicol dot de
line 520:
    if (needle->type == IS_STRING) {
        if (strlen(needle->value.str.val)==0) {
            php3_error(E_WARNING,"Empty delimiter");
        found = strstr(haystack->value.str.val, needle->value.str.val);

stig told me, that php strings should be binary safe, i believe that the strlen in the strpos-function is not.

i believe it sould read:

if (needle->value.str.lenl==0) {



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1998-09-18 11:05 UTC] zeev

strpos() as it is right now is not binary safe, and
that check is intentional, to protect the binary
unsafe implementation from receiving unexpected
arguments (and thus crash).
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 14:01:31 2024 UTC