Req #34945 [Fbk->Asn]: exec(): Problem with quotes in commandline
Edit report at https://bugs.php.net/bug.php?id=34945&edit=1
ID: 34945
User updated by: not-implemented at mark-plomer dot de
Reported by: not-implemented at mark-plomer dot de
Summary: exec(): Problem with quotes in commandline
-Status: Feedback
+Status: Assigned
Type: Feature/Change Request
Package: Program Execution
Operating System: WinXP
PHP Version: 5CVS-2005-10-21 (snap)
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Oh wow ... activity on my ~15 year old bug-report ;-) Yes I think it should be fine now, and you can
close the bug report as fixed :-) Thanks.
Previous Comments:
------------------------------------------------------------------------
[2020-01-27 12:08:10] cmb@php.net
I don't see a need to add an option. Regarding the original
report, the solution would be to enclose the command in another
pair of double-quotes, e.g.
system('""D:\Program Files\fop\fop.bat" "path with blanks/to/bla.fo"
"output path/bla.pdf""');
As of PHP 5.3.11, this additional pair of double-quotes is
inserted by PHP, so the original test script should work as is.
See also <https://github.com/php/php-src/pull/5102>.
------------------------------------------------------------------------
[2010-02-03 20:21:26] mplomer at gmx dot de
Since PHP 5.2.1 the proc_open() function has a new parameter "bypass_shell", which is the
needed feature.
It would be nice to have the same solution for all other shell related functions
(exec,shell_exec,system,...). For example via a php.ini option.
------------------------------------------------------------------------
[2005-10-27 19:38:14] mplomer at gmx dot de
cmd.exe /C accepts only two quotes in a commandline. If there are more, then the first and the last
quote is removed.
This makes it impossible to pass commandlines like:
"C:/Program Files/bla/bla.exe" "c:/my files/bla.txt"
So it is IMHO the best way, if we create an option to bypass the command-interpreter.
------------------------------------------------------------------------
[2005-10-21 14:58:25] cspeer at gmx dot de
I have the same problem. I have also no solution to execute commands with many quotes.
------------------------------------------------------------------------
[2005-10-21 14:18:37] mplomer at gmx dot de
Sure, it's not directly a Bug in PHP, but it's a feature-request to workaround a
bug/feature of cmd.exe:
We need a possibility to bypass the command-interpreter for execution of commands, since cmd.exe
can't execute it complete correctly.
Or someone finds a solution to escape quotes correctly. I will check this out over the weekend ;-)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=34945
--
Edit this bug report at https://bugs.php.net/bug.php?id=34945&edit=1
Thread (9 messages)