Doc #68076 [Opn]: mb_substr() incorrect documentation for length parameter
| From: | pasindu@php.net | Date: | Tue, 28 Apr 2015 17:35:12 +0000 |
| Subject: | Doc #68076 [Opn]: mb_substr() incorrect documentation for length parameter | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12267@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68076&edit=1
ID: 68076
Updated by: pasindu@php.net
Reported by: katrina at pixeldesigns dot ca
Summary: mb_substr() incorrect documentation for length
parameter
Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: Mac OSX
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
http://3v4l.org/iEirS seems there was a change between 5.4.7 and
5.4.8 that,
fixed this issues, probably changelog and a example should be added to show this
Previous Comments:
------------------------------------------------------------------------
[2014-09-22 18:31:55] katrina at pixeldesigns dot ca
Description:
------------
---
From manual page: http://www.php.net/function.mb-substr
---
Documentation states:
length parameter - If omitted or NULL is passed, extract all characters to the end of the string.
See here: http://php.net/manual/en/function.mb-substr.php
Ideally omitting NULL would result in a return value of all characters to the end of the string.
However, the next best solution would be to update the documentation so that it accurately describes
the behaviour of mb_subtr().
I have also noticed that other versions of this page do not contain that misleading statement, such
as on docs.php.net
Test script:
---------------
mb_substr('Hello I am a string', 6, NULL, 'UTF-8');
RETURNS 'I'
mb_substr('Hello I am a string', 6);
RETURNS 'I am a string'
Expected result:
----------------
mb_substr('Hello I am a string', 6, NULL, 'UTF-8');
RETURNS 'I am a string'
Actual result:
--------------
mb_substr('Hello I am a string', 6, NULL, 'UTF-8');
RETURNS 'I'
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68076&edit=1