php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41224 Quotes don't work on a program's path.
Submitted: 2007-04-29 13:13 UTC Modified: 2007-04-29 16:58 UTC
From: boen dot robot at gmail dot com Assigned:
Status: Not a bug Package: Program Execution
PHP Version: 5CVS-2007-04-29 (snap) OS: Windows XP Professional SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: boen dot robot at gmail dot com
New email:
PHP Version: OS:

 

 [2007-04-29 13:13 UTC] boen dot robot at gmail dot com
Description:
------------
When executing a command with system(), exec(), passthru() or shell_exec(), quotes in the program's path are not accepted and nothing is returned (except error code 1). The same command with quotes around the path works from the command line. Without quotes, the program only works if there are no spaces in the paths, which is where the real problem lies.

Reproduce code:
---------------
<?php
ini_set('display_errors','On');
ini_set('error_reporting',1);
print system('"D:\vasko\Software\XSLT2\saxonsa8-8n\bin\transform.exe" -a "D:\htdocs\XML\_benchmark\reference.xml"',$status);
print $status;
?>
Returns 1 (because of the "print $status" - otherwise it's an empty default HTML).

<?php
ini_set('display_errors','On');
ini_set('error_reporting',1);
print system('D:\vasko\Software\XSLT2\saxonsa8-8n\bin\transform.exe -a "D:\htdocs\XML\_benchmark\reference.xml"',$status);
print $status;
?>
Returns the output of the program, and 0 after it. This particular case works, but if the path had spaces, there would be no way to execute the program... not withing PHP anyway (a bat file could be a solution, but still...).

Expected result:
----------------
The program should run even if the path to it has quotes and it's output should be then printed.

Actual result:
--------------
The first code, when executed results in an error, which wouldn't be raised with the same command executed directly from the command line.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-29 15:04 UTC] sniper@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.


 [2007-04-29 16:58 UTC] boen dot robot at gmail dot com
Sorry. I searched the bug database, but couldn't find one. Only one about quotes on arguments, but none for program's paths. Can I have a link to this issue please? I would like to see the resolution (especially if by that you mean "workaround").
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 20:01:29 2024 UTC