php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3519 EscapeShellCmd is never useful
Submitted: 2000-02-17 16:13 UTC Modified: 2000-03-05 12:05 UTC
From: jon at oaktree dot co dot uk Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.11 OS: Unix
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jon at oaktree dot co dot uk
New email:
PHP Version: OS:

 

 [2000-02-17 16:13 UTC] jon at oaktree dot co dot uk
The EscapeShellCmd is not useful. What are you supposed to do with it? It's pointless.

You should instead have a new function, EscapeShellArg, which does the following:

function EscapeShellArg($cmd) {
  return "'".ereg_replace("'", "'\\''", $cmd)."'";
}

this way you actually *can* run shell processes safely, e.g.:

exec('/bin/foo arg1 arg2 '.EscapeShellArg($cgivar));

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-03-05 12:05 UTC] sas at cvs dot php dot net
This # was discussed on the mailing list. Please refer to the archives for the outcome.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Mon Oct 12 00:00:02 2026 UTC