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

Strings::indexOf() ends with ValueError for empty $haystack for negative $nth #271

KacerCZ opened this issue Nov 19, 2021 · 0 comments


Copy link

KacerCZ commented Nov 19, 2021

Version: 3.2.5
PHP: 8.0.12

Bug Description

Calling method Strings::indexOf() with parameter $haystack being empty string and negative parameter $nth will end with ValueError "strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)".

Steps To Reproduce

Execute following code

$position = \Nette\Utils\Strings::indexOf( '', 'a', -1 );
var_dump( $position );

ValueError is thrown

Expected Behavior

Variable $position contains NULL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

1 participant