ID: 40928 Updated by: [EMAIL PROTECTED] Reported By: phpbug dot 40928 at sub dot noloop dot net -Status: Open +Status: Feedback Bug Type: Feature/Change Request Operating System: Windows Server 2003 PHP Version: 5.2.1 New Comment:
Please test out 5.3 in which bug #43261 was fixed that uses the ^ escape character on Windows: http://bugs.php.net/bug.php?id=43261 Previous Comments: ------------------------------------------------------------------------ [2008-04-29 11:56:21] phpbug dot 40928 at sub dot noloop dot net Changing email, please ignore this comment. ------------------------------------------------------------------------ [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