|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2021-02-12 13:50 UTC] mikele890 at gmail dot com
Description:
------------
php < 8:
var_dump(false === mb_stripos('123456789', ''));
Result:
<br />
<b>Warning</b>: mb_stripos(): Empty delimiter in <b>[...][...]</b> on line <b>4</b><br />
bool(true)
php 8:
var_dump(false === mb_stripos('123456789', ''));
Result:
bool(false)
In versions lesser than 8 it will throw a warning but return true, which is totally opposite to version 8 result
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 22:00:01 2025 UTC |
php 8.0.2 var_dump(mb_stripos("test", "")); int(0) php 7.4.13 var_dump(mb_stripos("test", "")); <br /> <b>Warning</b>: mb_stripos(): Empty delimiter in <b>[...][...]</b> on line <b>5</b><br /> bool(false) so php 8 returns 0 and php 7 returns falseThe fact that strpos("test", ""); returns int(0) is a mistake, imo. This change is not mentioned in the migration guide too. And I'd like to hear what was a reasoning behind this change.