php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #299 Supplying quoted arguments via system() or exec()
Submitted: 1998-04-22 01:24 UTC Modified: 1998-05-15 21:36 UTC
From: jpronk at linkalarm dot com Assigned:
Status: Closed Package: Other
PHP Version: 3.0 Release Candidate 3 OS: Solaris
Private report: No CVE-ID: None
 [1998-04-22 01:24 UTC] jpronk at linkalarm dot com
I can't seem to get quoted arguments to commands to execute and
return output with the system() or exec() commands.

Eg.

system("script -name \"The Name Is\"",$returncode)

always returns a return a code of 1 and no output. I have tried using
combinations of single and double quotes, &quot, %20 for the
spaces. But no luck. 

Not sure if this is a bug or not, but the call in the unix
shell works just fine, but not using system() in php?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-05-15 21:36 UTC] zeev
It works fine for all of the tests I've put it through.
If you can provide us with a code snippet that demonstrates
the bug (including whatever PHP3 scripts or non-PHP3 scripts
are necessary) - please submita new bug report.
Here's a simple example that demonstrates that it works
fine:

---test.pl---
#!/usr/local/bin/perl -w
print "${ARGV[0]}\n";
exit(17);
-------------

--test.php3--
<?
system("./test.pl \"Hey there\"",$ret);
print "$ret\n";
?>
-------------

Result:
Hey there
17

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 06:01:28 2024 UTC