Closed KacerCZ closed 2 years ago
Version: 3.2.5 PHP: 8.0.12
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)".
Strings::indexOf()
$haystack
$nth
Execute following code
$position = \Nette\Utils\Strings::indexOf( '', 'a', -1 ); var_dump( $position );
ValueError is thrown
Variable $position contains NULL.
$position
NULL
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
ValueError is thrown
Expected Behavior
Variable
$position
containsNULL
.