#34671 [Opn]: strange exec behaviour on multiple quotes

From: Date: Wed, 28 Sep 2005 13:10:27 +0000
Subject: #34671 [Opn]: strange exec behaviour on multiple quotes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-85717@lists.php.net to get a copy of this message
ID: 34671 User updated by: wf at bitplan dot com Reported By: wf at bitplan dot com Status: Open Bug Type: Unknown/Other Function Operating System: Windows XP PHP Version: 5.0.5 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#85717) next »