php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #73123 Substr documentation is wrong and misleading
Submitted: 2016-09-20 10:49 UTC Modified: 2018-12-30 03:44 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: gregoire dot daussin at gmail dot com Assigned: girgias (profile)
Status: Assigned Package: Strings related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-09-20 10:49 UTC] 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 :(.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-28 14:06 UTC] cmb@php.net
-Package: Documentation problem +Package: Strings related
 [2018-12-30 03:44 UTC] girgias@php.net
-Status: Open +Status: Assigned -PHP Version: 5.6.26 +PHP Version: Irrelevant -Assigned To: +Assigned To: girgias
 [2018-12-30 03:44 UTC] girgias@php.net
I will have a look at it, however, this applies to all non-mb_ functions.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Mar 22 02:01:26 2019 UTC