Index: t3lib/utility/class.t3lib_utility_command.php =================================================================== --- t3lib/utility/class.t3lib_utility_command.php (revision 9961) +++ t3lib/utility/class.t3lib_utility_command.php (working copy) @@ -46,11 +46,37 @@ * @return null|array */ public static function exec($command, &$output = NULL, &$returnValue = 0) { - $lastLine = exec($command, $output, $returnValue); + $prefix = self::prefixCommandLine($command); + $lastLine = exec($prefix . $command, $output, $returnValue); return $lastLine; } /** + * Builds prefix for command line calls in Windows + * + * When using a call to a command line function in Windows and PHP < 5.3.0 and if there are more than two double quotes in + * the command will simply not work due to a bug in PHP. A workaround is to add a dummy command in front of the actual + * command + * + * @static + * @param string $path Path to command + * @return string Prefix for command + */ + protected static function prefixCommandLine($path) { + $prefixCommand = ''; + if (TYPO3_OS == 'WIN' && version_compare(phpversion(), '5.3.0') == -1) { + if (preg_match('/([a-z]:)/i', $path, $matches)) { + // if a drive letter is found, use it + $prefixCommand = $matches[1] . ' & '; + } else { + // fallback is drive c:, which should be present in Windows installations + $prefixCommand = 'c: & '; + } + } + return $prefixCommand; + } + + /** * Compile the command for running ImageMagick/GraphicsMagick. * * @param string Command to be run: identify, convert or combine/composite