Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zend_memnistr results are incorrect under certain conditions #12457

Closed
SakiTakamachi opened this issue Oct 17, 2023 · 1 comment
Closed

zend_memnistr results are incorrect under certain conditions #12457

SakiTakamachi opened this issue Oct 17, 2023 · 1 comment

Comments

@SakiTakamachi
Copy link
Member

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

SakiTakamachi added a commit to SakiTakamachi/php-src that referenced this issue Oct 17, 2023
SakiTakamachi added a commit to SakiTakamachi/php-src that referenced this issue Oct 17, 2023
@SakiTakamachi
Copy link
Member Author

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.

SakiTakamachi added a commit to SakiTakamachi/php-src that referenced this issue Oct 17, 2023
add test phpGH-12457

add test pattern phpGH-12457

Fix order of elvis of zend_memnistr
SakiTakamachi added a commit to SakiTakamachi/php-src that referenced this issue Oct 17, 2023
add test phpGH-12457

add test pattern phpGH-12457

Fix order of elvis of zend_memnistr

add more test cases for Fix phpGH-12457
SakiTakamachi added a commit to SakiTakamachi/php-src that referenced this issue Oct 17, 2023
add test phpGH-12457

add test pattern phpGH-12457

Fix order of elvis of zend_memnistr

add more test cases for Fix phpGH-12457

Fixed test expectations for phpGH-12457
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants