Bug #68617 [NEW]: numeric interpretation of false
| From: | r dot putz at gmx dot de | Date: | Wed, 17 Dec 2014 16:47:48 +0000 |
| Subject: | Bug #68617 [NEW]: numeric interpretation of false | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-189097@lists.php.net to get a copy of this message | ||
From: r dot putz at gmx dot de
Operating system: any
PHP version: 5.5.19
Package: Strings related
Bug Type: Bug
Bug description:numeric interpretation of false
Description:
------------
---
From manual page: http://www.php.net/function.substr-replace
---
in substr_replace param start = false is interpreted as numeric position
0.
(interpreting 0 as false maybe ok, but the other way round?..)
Test script:
---------------
/* example replacing delemiter in a string */
$string = "foo1, foo2, foo3";
$string = substr_replace($string, ' and', strrpos($string, ','), 1);
echo $string;
/* output as expected: "foo1, foo2 and foo3"; */
/* no delemiter in string so should do nothing */
$string = "foo1";
$string = substr_replace($string, ' and', strrpos($string, ','), 1);
echo $string;
/* wrong output: " andoo1"; */
--
Edit bug report at https://bugs.php.net/bug.php?id=68617&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68617&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68617&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68617&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68617&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68617&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68617&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68617&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68617&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68617&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68617&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68617&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68617&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68617&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68617&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68617&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68617&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68617&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68617&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68617&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68617&r=mysqlcfg