#34671 [Asn->Fbk]: strange exec behaviour on multiple quotes

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               34671
 Updated by:       [email protected]
 Reported By:      wf at bitplan dot com
-Status:           Assigned
+Status:           Feedback
 Bug Type:         Program Execution
 Operating System: win32 only
 PHP Version:      5.2.6
 Assigned To:      pajoye
 New Comment:

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)


Previous Comments:
------------------------------------------------------------------------

[2008-05-30 10:13:41] [email protected]

[11:11]	<Pierre>	RichardQ, assign these bugs to me and I will dispatch
them if necessary

------------------------------------------------------------------------

[2005-09-28 15:10:25] 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

------------------------------------------------------------------------

[2005-09-28 14:39:10] 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.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34671&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.