note 8324 added to escapeshellcmd
| From: | jon+php-dev at unequivocal dot co dot uk | Date: | Wed, 06 Sep 2000 12:09:45 +0000 |
| Subject: | note 8324 added to escapeshellcmd | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4242@lists.php.net to get a copy of this message | ||
Be VERY CAREFUL using this function. It is dangerous. The example given is incorrect.
I recommend using the following function instead:
function EscapeShellArg($x) {
return "'".ereg_replace("'", "'\\''",
$x)."'";
}
This can be safely used as follows:
exec('my-program '.EscapeShellArg($arg));
http://www.php.net/manual/function.escapeshellcmd.php