#30404 [Fbk->Opn]: wrong behaviour with escaped commands in safemode

From: Date: Sat, 23 Oct 2004 15:49:15 +0000
Subject: #30404 [Fbk->Opn]: wrong behaviour with escaped commands in safemode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-68015@lists.php.net to get a copy of this message
ID: 30404 User updated by: php-bug at angehrn dot com Reported By: php-bug at angehrn dot com -Status: Feedback +Status: Open Bug Type: Unknown/Other Function Operating System: Linux PHP Version: 4.3.9 New Comment: 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 ) Previous Comments: ------------------------------------------------------------------------ [2004-10-23 12:44:49] tony2001@php.net Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. How exactly does it fail? ------------------------------------------------------------------------ [2004-10-11 22:59:17] 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... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30404&edit=1

« previous php.bugs (#68015) next »