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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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: Sun Oct 11 23:00:01 2026 UTC