strpos() Emits TypeError¶
strpos() and stripos() emit a TypeError when the offset is of the wrong type. In PHP 7.4, it emitted a warning.
PHP code¶
<?php
strpos('a', 'abc', null);
?>
Before¶
PHP Warning: strpos() expects parameter 3 to be int, string given
After¶
PHP Fatal error: Uncaught TypeError: strpos(): Argument #3 ($offset) must be of type int, string given
PHP version change¶
This behavior changed in 8.0