Open syntaxler opened 2 years ago
It is mentioned in https://www.php.net/manual/en/migration80.incompatible.php:
The needle argument for strpos(), strrpos(), stripos(), strripos(), strstr(), stristr() and strrchr() can now be empty.
This needs to be added to the changelog of these functions.
Needle could always be empty, just the return value changed. I would suggest explaining in the docs what "The needle argument can now be empty" means in practise, that is having to check for the empty string every single time you use one of these functions if the needle could be empty, which it often times can.
While porting code to php 8.1 I have noticed that strpos() and stripos() return index 0 under php 8.x when searching for the empty string "" as needle in any haystack, while 7.x returned false under this circumstances. As far as I have seen this is not mentioned in the documentation of these functions, and also not in https://www.php.net/manual/en/migration80.incompatible.php
This change in behavior breaks code, please add it to the documentation.