note 111218 added to function.setlocale

From: Date: Sun, 27 Jan 2013 15:48:19 +0000
Subject: note 111218 added to function.setlocale
Groups: php.notes 
Request: Send a blank email to php-notes+get-193405@lists.php.net to get a copy of this message
<?php // the last foldername only contains a german umlaut (lower a with two dots = \xE4 in ISO-8859-1) $path = "/home/madmax/photos_from_the_last_10_years/\xE4" // php escapeshellarg remove characters (depends on locale settings) // the following example will delete /home/madmax/photos_from_the_last_10_years/ // instead of /home/madmax/photos_from_the_last_10_years/ä shell_exec(sprintf('rm -fr %s' escapeshellarg($path))); // dear php developers, how stupid is that? // I tell you: it is very very stupid! The problem exists since years and nothing happens (see bug #54391) // this code will not remove all your photos of the last 10 years :) function binary_safe_escapeshellarg_that_is_not_totally_buggy_and_do_not_remove_f___ing_characters($string) { return(@sprintf("'%s'", @strtr($string, Array("\x27" => "\x27\x5C\x27\x27")))); }; // delete /home/madmax/photos_from_the_last_10_years/ä // and not /home/madmax/photos_from_the_last_10_years/ shell_exec(sprintf('rm -fr %s' binary_safe_escapeshellarg_that_is_not_totally_buggy_and_do_not_remove_f___ing_characters($path))); // binary safe! ?> ---- Server IP: 213.172.110.14 Probable Submitter: 93.211.218.42 ---- Manual Page -- http://php.net/manual/en/function.setlocale.php Edit -- https://master.php.net/note/edit/111218 Del: integrated -- https://master.php.net/note/delete/111218/integrated Del: useless -- https://master.php.net/note/delete/111218/useless Del: bad code -- https://master.php.net/note/delete/111218/bad+code Del: spam -- https://master.php.net/note/delete/111218/spam Del: non-english -- https://master.php.net/note/delete/111218/non-english Del: in docs -- https://master.php.net/note/delete/111218/in+docs Del: other reasons-- https://master.php.net/note/delete/111218 Reject -- https://master.php.net/note/reject/111218 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#193405) next »