ID: 40928
User updated by: phpbug dot 40928 at sub dot noloop dot net
-Reported By: frode at coretrek dot com
+Reported By: phpbug dot 40928 at sub dot noloop dot net
Status: Open
Bug Type: Feature/Change Request
Operating System: Windows Server 2003
PHP Version: 5.2.1
New Comment:
Changing email, please ignore this comment.
Previous Comments:
------------------------------------------------------------------------
[2007-03-27 13:31:19] phpbug dot 40928 at sub dot noloop dot net
Description:
------------
On win32, the function escapeshellarg() replaces percent characters (%)
with spaces. Instead, the function should escape the percent character,
perhaps using the ^% construct, so that the percent sign can be safely
used as a an argument to an application executed through exec().
Reproduce code:
---------------
<?
// .... This creates a directory called "Test dir" (without the
quotes)
// .... which is unexpected.
$cmd = 'md';
$arg = 'test%dir';
$fullcmd = $cmd.' '.escapeshellarg($arg);
// .... This creates a directory called "Test%dir" (without the
quotes)
// .... which is the expected result of the above.
// $fullcmd = 'md test^%dir';
exec($fullcmd);
system("dir /B");
?>
Expected result:
----------------
test%dir
Actual result:
--------------
test dir
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40928&edit=1