Bug #27995

Quote arguments in system command on Windows

Added by Bastian Waidelich about 10 years ago. Updated about 10 years ago.

Status:
Resolved
Priority:
Should have
Category:
Core
Target version:
-
Start date:
2011-07-08
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

The bootstrap currently does not quote system call arguments on Windows. This leads to errors if the path to your php binary contains spaces.

$command = 'SET FLOW3_ROOTPATH=' . FLOW3_PATH_ROOT . '&' . 'SET FLOW3_CONTEXT=' . $this->context . '&' . $this->settings['core']['phpBinaryPathAndFilename'] . ' -c ' . php_ini_loaded_file() . ' ' . FLOW3_PATH_FLOW3 . 'Scripts/flow3' . ' ' . escapeshellarg($commandIdentifier);

Should be changed to:

$command = 'SET FLOW3_ROOTPATH="' . FLOW3_PATH_ROOT . '"&' . 'SET FLOW3_CONTEXT="' . $this->context . '"&"' . $this->settings['core']['phpBinaryPathAndFilename'] . '" -c "' . php_ini_loaded_file() . '" "' . FLOW3_PATH_FLOW3 . 'Scripts/flow3' . ' ' . escapeshellarg($commandIdentifier) . '"';

TODO: Test


Related issues

Related to TYPO3.Flow - Bug #31779: Command execution on Windows breaks with special chars in pathClosedBastian Waidelich2011-11-12

Actions
#1

Updated by Adrian Föder about 10 years ago

we should also consider changing the REM in the new flow3.bat file from

REM This can include the php.ini to be used (for example "SET PHP=C:/php/php.exe -c C:/php/php.ini")

to some kind of

REM This can include the php.ini to be used (for example SET PHP="C:/php/php.exe" -c "C:/php/php.ini"    )

So we should directly write the double quotes even if they are not necessary in the example; but to avoid errors when user rely on that suggestion.

#2

Updated by Mr. Hudson about 10 years ago

  • Status changed from New to Under Review

Patch set 1 of change Ief9eb0e1800cd9810867e607ba66456dcbb3ee4e has been pushed to the review server.
It is available at http://review.typo3.org/3243

#3

Updated by Mr. Hudson about 10 years ago

Patch set 2 of change Ief9eb0e1800cd9810867e607ba66456dcbb3ee4e has been pushed to the review server.
It is available at http://review.typo3.org/3243

#4

Updated by Bastian Waidelich about 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF