php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34671 strange exec behaviour on multiple quotes
Submitted: 2005-09-28 14:39 UTC Modified: 2008-08-26 01:00 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: wf at bitplan dot com Assigned: pajoye (profile)
Status: No Feedback Package: Program Execution
PHP Version: 5.2.6 OS: win32 only
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-09-28 14:39 UTC] wf at bitplan dot com
Description:
------------
in the code below
$cmd='"C:/Programme/MySQL/MySQL Server 4.1/bin/mysql.exe" --execute=status';
works, but
$cmd='"C:/Programme/MySQL/MySQL Server 4.1/bin/mysql.exe" --execute="status"';
does not. The error message is:
failed with return-code: 1
Der Befehl "C:/Programme/MySQL/MySQL" ist entweder falsch geschrieben oder konnte nicht gefunden werden.

This is very strange, since running the command in a cmd box in Windows works in both cases.

Reproduce code:
---------------
$_output=array();		
$cmd='"C:/Programme/MySQL/MySQL Server 4.1/bin/mysql.exe" --execute="status"';
exec($cmd,$_output,$_retval); 
if ($_retval==0) {
   echo 'and done !<br />';
}	else {
echo " failed with return-code: ".$_retval;  		
foreach($_output as $_outputline){
  echo("$_outputline<br />");
}	


Expected result:
----------------
exec should work in both cases

Actual result:
--------------
failed with return-code: 1
Der Befehl "C:/Programme/MySQL/MySQL" ist entweder falsch geschrieben oder konnte nicht gefunden werden.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-28 15:10 UTC] wf at bitplan dot com
it's not a PHP but a cmd.exe problem:

""C:/Programme/MySQL/MySQL Server 4.1/bin/mysql.exe" --user=smartrqm --password=6y-app% --database=smartRQM --execute="status""

works. This is due to the way cmd /c works which is obviously used internally. See cmd /help on how cmd.exe handles quotes
 [2008-05-30 10:13 UTC] rquadling@php.net
[11:11]	<Pierre>	RichardQ, assign these bugs to me and I will dispatch them if necessary
 [2008-08-18 08:05 UTC] pajoye@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.3-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.3-win32-installer-latest.msi

(The Zip version)
 [2008-08-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-11-18 01:04 UTC] louis at steelbytes dot com
broken in 5.2.6
tested 5.3.0alpha2, and now works.

simply used 
  system('"fr" "ed"');
with procmon from sysinternals to see what is executed.

5.2.6 shows
  cmd.exe /c "fr" "ed"
5.3.0alpha2 shows
  cmd.exe /c ""fr" "ed""
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC