Project

General

Profile

Actions

Bug #102736

open

Install Tool Configuration Presets broken for image handling settings with debug mode enabled

Added by Arne Bracht 4 months ago. Updated 4 months ago.

Status:
New
Priority:
Should have
Assignee:
Category:
Backend User Interface
Target version:
-
Start date:
2024-01-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Configuration Presets
Complexity:
Is Regression:
Sprint Focus:

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.


Related issues 1 (1 open0 closed)

Is duplicate of TYPO3 Core - Bug #101778: Configuration Presets open_basedirUnder Review2023-08-28

Actions
Actions #1

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;
    }
Actions #2

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.

Actions #3

Updated by Garvin Hicking about 2 months ago

  • Is duplicate of Bug #101778: Configuration Presets open_basedir added
Actions

Also available in: Atom PDF