Skip to content

zend_memnistr results are incorrect under certain conditions #12457

Closed

Description

@SakiTakamachi

Description

The following code:

<?php
var_dump(stripos('aaBBBBBbb', 'b'));

Resulted in this output:

int(7)

But I expected this output instead:

int(2)

This occurs when the following conditions are met:

  • $needle is single character
  • (Number of characters from the first lowercase letter to the end) >= (Number of characters from the beginning to the first uppercase letter)
  • Uppercase letters appear before lowercase letters

PHP Version

PHP8.2+

Operating System

any

Activity

  1. SakiTakamachi commented on Oct 17, 2023

    @SakiTakamachi
    MemberAuthor

    As you know, this affects stripos() and stristr().

    The master branch uses php_memnistr in the curl options set, but since needle is not a single character, it is not affected.

  2. added a commit that references this issue on Oct 18, 2023
    736032f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions