#22243Several GIFBUILDER features broken for IM6 and GM
Description
When IM6 or GM are used, several GIFBUILDER features that internally use mask images (e.g. SHADOW and NICETEXT) are broken.
The reason is a flawed processing of quoted parts in IM commands that probably has many more side effects.
Function unQuoteFilenames() in t3lib/class.t3lib_div explodes the IM/GM parameter string by blanks and tries to do a kind of CVS explode that honors quotes within the parameter string and does not explode quoted params if they contain blanks.
This is done by searching for quotes at the beginning and end of each item in the parameter string. If an item starts with a quote, all subsequent items are joint with it until an item is found that ends with a quote.
Unfortunatelly the function does not check, whether an item starting with a quote already contains a closing quote at its end. This leads to the effect that at least 2 quoted items are joint, even if they contain opening AND closing quotes.
As 4.3 quotes the IM arguments very consequently (in contrast to 4.2), this leads to many subsequent errors in 4.3 that did not become visible in 4.2 (although the basic flaw already exists in 4.2). Among those subsequent errors are the GIFBUILDER failures listed above.
Here is an example of a typical content of the array returned from function t3lib_div::unQuoteFilenames() WITHOUT and WITH the patch. (This example is from a GIFBUILDER SHADOW calculation.)
WITHOUT PATCH
Array
(
[0] => +profile
[1] => ‘*’
[2] => -compose
[3] => over
[4] => +matte
[5] => “typo3temp/temp/b49e8fb309f9a66316a4d252edc964f1_menuNT.gif” “typo3temp/temp/b49e8fb309f9a66316a4d252edc964f1_colorNT.gif“
[6] => “typo3temp/temp/941a8f43294c13c906c4039dc3a8c9db.gif” “typo3temp/temp/b49e8fb309f9a66316a4d252edc964f1_menuNT.gif”
)
WITH PATCH
Array
(
[0] => +profile
[1] => ‘*’
[2] => -compose
[3] => over
[4] => +matte
[5] => “typo3temp/temp/b49e8fb309f9a66316a4d252edc964f1_menuNT.gif”
[6] => “typo3temp/temp/b49e8fb309f9a66316a4d252edc964f1_colorNT.gif“
[7] => “typo3temp/temp/941a8f43294c13c906c4039dc3a8c9db.gif”
[8] => “typo3temp/temp/b49e8fb309f9a66316a4d252edc964f1_menuNT.gif”
)
Without the patch any subsequent processing will risk to fail when working on the result and expecting its parameters at certain positions.
SOLUTION:
The solution is simple. When testing substrings for leading quotes, the function may only go into “start quote found” mode if the substring does not also contain a trailing quote. This is done by a simple extension of the regular expression used to detect leading quotes.
(issue imported from #M13750)
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Related issues 6
- Bug #17489Install Tool image tests fail when there are spaces in the path name
- Bug #22322combining images with GraphicsMagick not working correctly since 4.2.10
- Bug #24377t3lib_div::unQuoteFilenames fails to detect quotes properly
- Bug #24378Frame added to IM/GM commands should be inside quotes
- Bug #24379t3lib_stdGraphic::wrapFileName performs escapeshellarg even in safe_mode
- Bug #24931Quoting of path and filename in ImageMagick/GraphicsMagick not working on Windows + PHP5.2