php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #14853 escapeshellarg should return '' for empty argument list
Submitted: 2002-01-04 13:05 UTC Modified: 2003-02-06 21:12 UTC
From: jbriggs at esoft dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.1.0 OS: Linux
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: jbriggs at esoft dot com
New email:
PHP Version: OS:

 

 [2002-01-04 13:05 UTC] jbriggs at esoft dot com
If I build a command line like this:
$cmd  = "ls ";
$cmd .= escapeshellarg($file);
system($cmd);

It works fine if $file contains data.  But if $file is empty, $cmd is "ls " instead of "ls ''".

The code would be easier to write if escapeshellarg always returned the two single quotes, even if its argument was blank.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-06 21:12 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

This seems like a rather unexpected behaviour to me and if the feature you request is added it'll likely break many scripts.
Do your own input validation.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 06 08:01:26 2024 UTC