Doc #80738 [PATCH]: Document that mb_stripos() now accepts an empty needle
From: hallberg.kim@gmail.com Date: Tue, 25 May 2021 09:08:52 +0000 Subject: Doc #80738 [PATCH]: Document that mb_stripos() now accepts an empty needle References: 1 Groups: php.doc.bugs Request: Send a blank email to doc-bugs+get-18802@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80738&edit=1
ID: 80738
Patch added by: hallberg.kim@gmail.com
Reported by: mikele890 at gmail dot com
Summary: Document that mb_stripos() now accepts an empty
needle
Status: Verified
Type: Documentation Problem
Package: mbstring related
Operating System: Linux
PHP Version: 8.0.2
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: [80738] WIP: Update MB string functions
On GitHub: https://github.com/php/doc-en/pull/630
Patch: https://github.com/php/doc-en/pull/630.patch
Previous Comments:
------------------------------------------------------------------------
[2021-02-15 13:32:30] domnulnopcea at gmail dot com
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 false
------------------------------------------------------------------------
[2021-02-12 14:42:35] rtrtrtrtrt at dfdfdfdf dot dfd
the old behavior was simply wrong
think logically: in most cases the second param is dynamic adn an empty string means "no
input" - how das it make sense to pretend that *nothing* is within everything?
------------------------------------------------------------------------
[2021-02-12 14:02:50] cmb@php.net
This is only documented in the migration guide[1] so far:
| The needle argument for mb_strpos(), mb_strrpos(), mb_stripos(),
| mb_strripos(), mb_strstr(), mb_stristr(), mb_strrchr() and
| mb_strrichr() can now be empty.
[1] <https://www.php.net/manual/en/migration80.incompatible.php>
------------------------------------------------------------------------
[2021-02-12 13:50:25] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80738&edit=1
Thread (7 messages)
- Unknown Message
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [PATCH]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Unknown Message
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [PATCH]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Unknown Message
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [PATCH]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Unknown Message
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [PATCH]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Unknown Message
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [PATCH]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Unknown Message
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [PATCH]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Unknown Message
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [Com]: mb_stipos function
- Doc #80738 [PATCH]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
- Doc #80738 [Com]: Document that mb_stripos() now accepts an empty needle
| « previous | php.doc.bugs (#18802) | next » |
|---|