Skip to content

zend_memnistr results are incorrect under certain conditions #12457

Closed
@SakiTakamachi

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

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