php / php/doc-en

strpos() and stripos() changed behavior under 8.x that is not documented

Open
#1,927 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Category: Strings
Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

While porting code to php 8.1 I have noticed that strpos() and stripos() return index 0 under php 8.x when searching for the empty string "" as needle in any haystack, while 7.x returned false under this circumstances. As far as I have seen this is not mentioned in the documentation of these functions, and also not in https://www.php.net/manual/en/migration80.incompatible.php

This change in behavior breaks code, please add it to the documentation.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the strpos() and stripos() documentation entries and review the migration80.incompatible.php page mentioned in the issue. Compare their current notes with the reported PHP 7 and PHP 8 behavior; done means the changed empty-string behavior is documented in the relevant function reference and migration documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.