#43467 [NEW]: function substr() does not function the same
| From: | mgd at xpressbillpay dot com | Date: | Sat, 01 Dec 2007 08:50:51 +0000 |
| Subject: | #43467 [NEW]: function substr() does not function the same | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-120260@lists.php.net to get a copy of this message | ||
From: mgd at xpressbillpay dot com
Operating system: Windows XP and server 2003
PHP version: 5.2.5
PHP Bug Type: Unknown/Other Function
Bug description: function substr() does not function the same
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 bug report at http://bugs.php.net/?id=43467&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43467&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43467&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43467&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43467&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43467&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=43467&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43467&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43467&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43467&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43467&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43467&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=43467&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=43467&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43467&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43467&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43467&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43467&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43467&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43467&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43467&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43467&r=mysqlcfg