From: phpbugs at dev dot bitadept dot org Operating system: Gentoo Linux PHP version: 5.5.5 Package: Filesystem function related Bug Type: Bug Bug description:basename is no more working after fgetcsv in certain situation
Description: ------------ Calls to basename and pathinfo are no more working after using fgetcsv. This is the case when the system's locale is set to utf8 an you try to parse a file using fgetcsv that is encoding in iso8859-1 and contains some german Umlaute. Setting the locale to iso8859-1 in the first place is fixing the problem, but this should not happen at all. System information: $ uname -a Linux Merlin 3.5.4-hardened-r1 #2 SMP Mon Jan 21 09:21:26 CET 2013 x86_64 Intel(R) Core(TM) i5 CPU M 520 @ 2.40GHz GenuineIntel GNU/Linux $ locale LANG= LC_CTYPE="de_DE.UTF-8" LC_NUMERIC="de_DE.UTF-8" LC_TIME="de_DE.UTF-8" LC_COLLATE="de_DE.UTF-8" LC_MONETARY="de_DE.UTF-8" LC_MESSAGES="de_DE.UTF-8" LC_PAPER="de_DE.UTF-8" LC_NAME="de_DE.UTF-8" LC_ADDRESS="de_DE.UTF-8" LC_TELEPHONE="de_DE.UTF-8" LC_MEASUREMENT="de_DE.UTF-8" LC_IDENTIFICATION="de_DE.UTF-8" LC_ALL=de_DE.UTF-8 $ php -v PHP 5.5.5-pl0-gentoo (cli) (built: Oct 22 2013 15:56:09) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies Test script: --------------- <?php $a = '/tmp/somefile.csv'; echo "define: ".basename($a)."\n"; $fp = fopen($a, 'r'); echo "fopen: ".basename($a)."\n"; while (($lineArray = fgetcsv($fp, 0, ';')) !== FALSE); echo "fgetcsv: ".basename($a)."\n"; fclose($fp); echo "fclose: ".basename($a)."\n"; Expected result: ---------------- define: somefile.csv fopen: somefile.csv fgetcsv: somefile.csv fclose: somefile.csv Actual result: -------------- define: somefile.csv fopen: somefile.csv fgetcsv: fclose: -- Edit bug report at https://bugs.php.net/bug.php?id=65947&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65947&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=65947&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65947&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65947&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65947&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65947&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65947&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65947&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65947&r=support Expected behavior: https://bugs.php.net/fix.php?id=65947&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65947&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65947&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65947&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65947&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65947&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65947&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65947&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65947&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65947&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65947&r=mysqlcfg