Bug #102736
openInstall Tool Configuration Presets broken for image handling settings with debug mode enabled
0%
Description
Hello,
Upgrade from 11.5.33auf 12.4.9.
If "Configuration Presets" ist set to Debug the "Configuration Presets" is broken. It returns an AJAX Error:
Core: Error handler (BE): PHP Warning: file_exists(): open_basedir restriction in effect. File(/opt/local/bin/identify) is not within the allowed path(s): (/usr/bin/) in /typo3_src-12.4.9/typo3/sysext/install/Classes/Configuration/Image/ImageMagick6Preset.php line 81
Core: Error handler (BE): PHP Warning: file_exists(): open_basedir restriction in effect. File(/opt/local/bin/gm) is not within the allowed path(s): (/usr/bin/) in /typo3_src-12.4.9/typo3/sysext/install/Classes/Configuration/Image/GraphicsMagickPreset.php line 77
Temporär solution set "Configure Installation-Wide Options" -> [GFX][processor_path] from /usr/bin/ to /usr/bin. Then "Configuration Presets" load without error. Set Debug mode to off an then you can use "Configuration Presets" again to switch preset between GraphicsMagick and ImageMagick6.
Updated by Arne Bracht 4 months ago
So, the error comes from:
if (!file_exists($binaryPath) || !is_executable($binaryPath))In Debug mode the php warning breaks the preset setup.
What about this suggestion: Ad a if(@is_readable($path)) to avoid the warning, befor the file_exists check? Works in both files ImageMagick6Preset.php and GraphicsMagickPreset.php Sorry that I don't have the knowledge to make it as a patch request.
protected function findImageMagick6InPaths(array $searchPaths)
{
$result = false;
foreach ($searchPaths as $path) {
if (Environment::isWindows()) {
$executable = 'identify.exe';
if (!@is_file($path . $executable)) {
$executable = 'magick.exe';
}
} else {
$executable = 'identify';
}
if(@is_readable($path)) {
$binaryPath = $path . $executable;
if (!file_exists($binaryPath) || !is_executable($binaryPath)) {
continue;
}
$command = escapeshellarg($binaryPath) . ' -version';
$executingResult = [];
CommandUtility::exec($command, $executingResult);
// First line of exec command should contain string GraphicsMagick
$firstResultLine = array_shift($executingResult);
// Example: "Version: ImageMagick 6.6.0-4 2012-05-02 Q16 http://www.imagemagick.org"
if (is_string($firstResultLine) && str_contains($firstResultLine, 'ImageMagick')) {
[, $version] = explode('ImageMagick', $firstResultLine);
// Example: "6.6.0-4"
[$version] = explode(' ', trim($version));
if (version_compare($version, '6.0.0') >= 0) {
$this->foundPath = $path;
$result = true;
break;
}
}
}
}
return $result;
}
Updated by Stefan Bürk 4 months ago
- Assignee set to Stefan Bürk
Simply suppressing the warning is not a real solution, and should only be used
where there is absolutly no way arround. Not sure about a proper solution directly,
but will put it on my list to recheck this and create a patch then.
Updated by Garvin Hicking about 2 months ago
- Is duplicate of Bug #101778: Configuration Presets open_basedir added