Doc #73123 [Com]: Substr documentation is wrong and misleading
| From: | balazs dot kovacs at gmail dot com | Date: | Thu, 01 Oct 2020 07:13:33 +0000 |
| Subject: | Doc #73123 [Com]: Substr documentation is wrong and misleading | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-17936@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73123&edit=1
ID: 73123
Comment by: balazs dot kovacs at gmail dot com
Reported by: gregoire dot daussin at gmail dot com
Summary: Substr documentation is wrong and misleading
Status: Assigned
Type: Documentation Problem
Package: Strings related
PHP Version: Irrelevant
Assigned To: girgias
Block user comment: N
Private report: N
New Comment:
Please fix this. I just ran into this issue after a very arduous debugging process which could have
been cut short if there was any mention in the documentation about the mb_substr! Not to mention
that my substr returned null and threw nothing while this behaviour is not in the documentation. The
string I was running the function on had simple 'ä' (U+00E4) characters in them, UTF8
encoded. Also this has previously not caused any issues running through substr.
Previous Comments:
------------------------------------------------------------------------
[2018-12-30 03:44:15] girgias@php.net
I will have a look at it, however, this applies to all non-mb_ functions.
------------------------------------------------------------------------
[2016-09-20 10:49:00] gregoire dot daussin at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.substr
---
Substr documentation talks about characters everywhere, while the function does not cut string
characters wise but bytes wise, this is especially true for UTF-8.
The documentation should talk about bytes, and make a note about mb_substr.
Please fix, it is confusing, I've lied to since years :(.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73123&edit=1