#43467 [Opn->Bgs]: function substr() does not function the same
| From: | iliaa@php.net | Date: | Sun, 02 Dec 2007 16:05:21 +0000 |
| Subject: | #43467 [Opn->Bgs]: function substr() does not function the same | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-120278@lists.php.net to get a copy of this message | ||
ID: 43467
Updated by: iliaa@php.net
Reported By: mgd at xpressbillpay dot com
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Windows XP and server 2003
PHP Version: 5.2.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
.
Previous Comments:
------------------------------------------------------------------------
[2007-12-01 11:28:23] felipe@php.net
Anyway, says the documentation:
"If start denotes a position beyond this truncation, an empty string
will be returned."
------------------------------------------------------------------------
[2007-12-01 08:50:51] mgd at xpressbillpay dot com
Description:
------------
script using substr($strVal, -10);
if $strVal length is less then 10 chars (or less then int start) the
return value is empty.
In a previous version(I had 5.1.4 before upgrade) substr($strVal, -10);
would still return the full #strVal if less then 10 which it should
since int start should begin from the last character and count back x
number of chars and stop at the first if $strVal is less the the count.
Reproduce code:
---------------
<?PHP
$str = "1234567";
echo substr($str,-8);
?>
Expected result:
----------------
1234567
Actual result:
--------------
empty
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43467&edit=1