|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-03-26 15:18 UTC] felipe@php.net
[2011-03-26 15:18 UTC] felipe@php.net
-Status: Open
+Status: Bogus
[2011-03-26 15:18 UTC] felipe@php.net
[2011-03-26 15:35 UTC] c dot madmax at gmail dot com
[2011-03-26 16:11 UTC] felipe@php.net
-Status: Bogus
+Status: Open
[2013-02-03 23:54 UTC] me at paulofreitas dot me
[2015-02-03 07:01 UTC] yohgaki@php.net
-Operating System: All Debian and Ubuntu Versions
+Operating System: any
-PHP Version: 5.3.6
+PHP Version: any
[2015-02-03 07:01 UTC] yohgaki@php.net
[2017-02-07 11:06 UTC] netvicious at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 03:00:02 2025 UTC |
Description: ------------ escapeshellarg() strip non-ascii characters if the LANG environment variable is not set to somthing like LANG=*.ISO-8959-1 e.g. LANG=en_US.ISO-8959-1 The job of escapeshellarg() is only to escape characters and NOT to remove them!!! The manual say nothing about removing characters!!! Removing characters can cause horrible results!!! It should doesn't matter if a shell arg has a ISO-8959-1 charset or UTF-8 charset or any other charset, because it is possible that a filename has a ISO-8959-1 charset and a other filename has a UTF-8 charset!!! escapeshellarg() should only look for quotes and escape them, and nothing else!!! PS: setlocale(LC_ALL, 'en_US.ISO-8959-1') and/or putenv('LANG=en_US.ISO-8959-1') dosn't fix this problem! And i think even if this work it's not good a solution! Test script: --------------- <?php $path = escapeshellarg('/home/www-data/äöüÄÖÜß'); // ISO-8959-1 characters = "\xE4\xF6\xFC\xC4\xD6\xDC\xDF" in hex format shell_exec(sprintf('rm -fr %s', $path)); echo sprintf('%s removed', $path); ?> Expected result: ---------------- The test script should remove the folder /home/www-data/äöüÄÖÜß and output: '/home/www-data/äöüÄÖÜß' removed Actual result: -------------- The test script remove the folder /home/www-data/ and output '/home/www-data/' removed