Bug #27995
Quote arguments in system command on Windows
Status: | Resolved | Start date: | 2011-07-08 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Bastian Waidelich | % Done: | 100% |
|
Category: | Core | |||
Target version: | - | |||
PHP Version: | Complexity: | |||
Has patch: | Affected Flow version: |
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
Associated revisions
[BUGFIX] Properly escape and quote CLI arguments
Currently arguments that are passed to the system() function in
Bootstrap::executeCommand() are not properly escaped.
This leads to errors if arguments / paths contain spaces.
Change-Id: Ief9eb0e1800cd9810867e607ba66456dcbb3ee4e
Resolves: #27995
History
#1 Updated by Adrian Föder about 4 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 4 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 4 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 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 7bb24f9dc49324d2ed931d641b7dbe6ffe6934f7.