Doc #71648 [Com]: [DE] substr('abc', 3) returns string(0) "" for php7
| From: | sigma_z at sigma-scripts dot de | Date: | Wed, 24 Feb 2016 20:17:08 +0000 |
| Subject: | Doc #71648 [Com]: [DE] substr('abc', 3) returns string(0) "" for php7 | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13215@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71648&edit=1
ID: 71648
Comment by: sigma_z at sigma-scripts dot de
Reported by: sigma_z at sigma-scripts dot de
Summary: [DE] substr('abc', 3) returns string(0) "" for php7
Status: Closed
Type: Documentation Problem
Package: Translation problem
Operating System: Ubuntu 14
PHP Version: 7.0Git-2016-02-23 (snap)
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Yes, it's much better now. Thanks a lot.
Previous Comments:
------------------------------------------------------------------------
[2016-02-23 21:39:10] requinix@php.net
Until the online docs are updated with @cmb's change, look at the English version.
http://php.net/manual/en/function.substr.php
- The Changelog specifically states what changed.
- Example #4 shows the behaviors of substr with different inputs. Part 6) shows what happens if you
call the function with $start == strlen($string), and shows it both for PHP 7 (empty string) and for
PHP 5 (false).
- The Errors/Exceptions example shows it returning false with $start=2 (beyond the end of the
string) instead of $start=1 (at the end).
Is that enough to show that the behavior has changed with PHP 7?
------------------------------------------------------------------------
[2016-02-23 21:26:27] sigma_z at sigma-scripts dot de
When you like to see this issue as documentation (translation) problem instead of a bug at http://php.net/manual/de/function.substr.php
and think it could be easily solved by just changing the default value for argument $start, then
I'd like insist that the documentation will show the different version behaviors, for example
like this:
<?php
var_dump(substr('a', 1)); // bool(false) if php version < 7
var_dump(substr('a', 1)); // string(2)"" if php version >= 7
?>
In my option it still seems more a bug than a desired behavior. I see no value in this new behavior
for php7, but may be you can change my mind.
------------------------------------------------------------------------
[2016-02-23 11:51:25] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
------------------------------------------------------------------------
[2016-02-23 11:50:47] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=338652
Log: synced with EN (fixes #71648: [DE] substr('abc', 3) returns string(0)
"" for php7)
------------------------------------------------------------------------
[2016-02-23 08:51:07] requinix@php.net
German translation is out of date.
http://php.net/manual/de/function.substr.php
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=71648
--
Edit this bug report at https://bugs.php.net/bug.php?id=71648&edit=1