|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-10-11 22:59 UTC] php-bug at angehrn dot com
Description:
------------
if safe_mode is on, i cannot use a command with backslash escaped commands in exec()
Reproduce code:
---------------
safe_mode off
exec('convert logo: "test 1.jpg"'); - works
exec('convert logo: test\ 1.jpg'); - works
safe_mode on
exec('convert logo: "test 1.jpg"'); - works
exec('convert logo: test\ 1.jpg'); - fails
Expected result:
----------------
it should work like the command with safemode off
Actual result:
--------------
it fails...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 24 10:00:01 2025 UTC |
with a small shell script, you can reproduce the wrong behaviour: Reproduce code: --------------- test.php: ---- <?php exec('./test_script "test 1.jpg"',$array1,$return1); exec('./test_script test\ 1.jpg', $array2,$return2); echo '<pre>'; echo $return1; print_r($array1); echo '<br /><br />'; echo $return2; print_r($array2); echo '</pre>'; ?> ---- test_script: ---- #!/bin/sh echo $1 echo $2 exit 0 ---- Expected result: ---------------- 0Array ( [0] => test 1.jpg [1] => ) 0Array ( [0] => test 1.jpg [1] => ) Actual result: -------------- 0Array ( [0] => test 1.jpg [1] => ) 0Array ( [0] => test\ [1] => 1.jpg )