|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-06-22 15:18 UTC] 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\)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 17 11:00:01 2025 UTC |
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.