ID: 28881 Updated by: [EMAIL PROTECTED] Reported By: uncle at fedor dot com -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: Linux SuSE 8.2 PHP Version: 4.3.7 New Comment:
Unless you have safe_mode enabled exec functions do not perform any automatic escaping. With PHP 4.3.7 without safe_mode exec ("touch \"Now both spaces (and parentheses)\"); works as expected. Previous Comments: ------------------------------------------------------------------------ [2004-06-22 15:18:41] uncle at fedor dot com Description: ------------ exec() gives the following results when working with files containing spaces *and* parentheses/brackets on Linux: If the filename to be passed by the exec() function is enclosed in quotes "..." (to handle the spaces) then the backslashes are added before the following symbols: ( ) [ ] { } and possibly before some other ones I haven't discovered. Reproduce code: --------------- 1. exec ("touch \"Testfile without parentheses.txt\""); 2. exec ("touch Now_without_spaces_(but_with_parenteses)"); 3. exec ("touch \"Now both spaces (and parentheses)\"); Expected result: ---------------- 1. Creating file: Testfile without parentheses.txt 2. Creating file: Now_without_spaces_(but_with_parentheses) 3. Creating file: Now both spaces (and parentheses) Actual result: -------------- 1. Creating file: Testfile without parentheses.txt 2. Creating file: Now_without_spaces_(but_with_parentheses) 3. Creating file: Now both spaces \(and parentheses\) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28881&edit=1