|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80952 Against an empty needle it returns [0] instead of [false]
Submitted: 2021-04-12 16:34 UTC Modified: 2021-04-12 16:37 UTC
From: charro at protonmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 8.0.3 OS: Linux
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: charro at protonmail dot com
New email:
PHP Version: OS:


 [2021-04-12 16:34 UTC] charro at protonmail dot com
From manual page:
The function returns [0] instead of [false] if it is searched agains an empty string ''

Prior to PHP 8 the function returned [false]

Test script:
var_dump( stripos( '', '' ) );

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-04-12 16:37 UTC]
-Status: Open +Status: Not a bug
 [2021-04-12 16:37 UTC]
PHP 8 supports empty needles in string search functions, and no longer treats them as an error condition. For most functions this previously resulted in a warning (, stripos() is an exception to that rule.

Noted on

> The needle argument for strpos(), strrpos(), stripos(), strripos(), strstr(), stristr() and strrchr() can now be empty.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 12 13:01:33 2024 UTC