Bug #71648 [NEW]: substr('abc', 3) returns string(0) "" for php7
| From: | sigma_z at sigma-scripts dot de | Date: | Tue, 23 Feb 2016 08:04:47 +0000 |
| Subject: | Bug #71648 [NEW]: substr('abc', 3) returns string(0) "" for php7 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-199411@lists.php.net to get a copy of this message | ||
From: sigma_z at sigma-scripts dot de
Operating system: Ubuntu 14
PHP version: 7.0Git-2016-02-23 (snap)
Package: Strings related
Bug Type: Bug
Bug description:substr('abc', 3) returns string(0) "" for php7
Description:
------------
When using substr on the end of a given string than it returns an emtpy
string instead of a boolean false for php7 or greater.
Test script:
---------------
for php < 7
<?php
substr('abc', 3) returns false
?>
for php >= 7
<?php
substr('abc', 3) returns string(0) ""
?>
The documentation says (which does not apply for php7):
<?php
var_dump(substr('a', 1)); // bool(false)
?>
Expected result:
----------------
Whether update the documentation on
http://php.net/manual/en/function.substr.php
if this is the desired
behavior or fix substr() when trying to get the string on the end of the
given string.
--
Edit bug report at https://bugs.php.net/bug.php?id=71648&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71648&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71648&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71648&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71648&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71648&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71648&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71648&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71648&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71648&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71648&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71648&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71648&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71648&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71648&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71648&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71648&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71648&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71648&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71648&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71648&r=mysqlcfg