Bug #70479 [NEW]: Substr() appends invisible characters
| From: | nino dot skopac at gmail dot com | Date: | Sun, 13 Sep 2015 01:00:06 +0000 |
| Subject: | Bug #70479 [NEW]: Substr() appends invisible characters | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-195973@lists.php.net to get a copy of this message | ||
From: nino dot skopac at gmail dot com
Operating system: Win 10 x64 (winver=10240)
PHP version: 7.0.0RC2
Package: Strings related
Bug Type: Bug
Bug description:Substr() appends invisible characters
Description:
------------
When using substr() on v.7 RC2 on my local machine, I am getting
different results than when I run the same script on my Linux webserver
running v. 5.6.11
Test script:
---------------
<?php
error_reporting(E_ALL);
ob_start();
?>
resources/layout.css
resources/jquery.fancybox.css
<?php
$files = ob_get_clean();
$fs = explode("\n", $files);
foreach($fs as $f) {
$ext = substr($f, strrpos($f, "."), strlen($f));
$ext_trimmed = trim($ext);
var_dump($ext, $ext_trimmed);
}
?>
Expected result:
----------------
string(4) ".css"
string(4) ".css"
string(4) ".css"
string(4) ".css"
bool(false)
string(0) ""
Actual result:
--------------
string(5) ".css"
string(4) ".css"
string(5) ".css"
string(4) ".css"
string(0) ""
string(0) ""
--
Edit bug report at https://bugs.php.net/bug.php?id=70479&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70479&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70479&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70479&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70479&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70479&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70479&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70479&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70479&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70479&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70479&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70479&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70479&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70479&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70479&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70479&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70479&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70479&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70479&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70479&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70479&r=mysqlcfg