[TYPO3-core] RFC #17419: Bug: Image generation broken with safe_mode on

Jan Radecker radecker at iwelt.de
Mon Jan 31 13:51:24 CET 2011


This is an SVN patch request.

Type: Bugfix

Bugtracker references: http://bugs.typo3.org/view.php?id=17419

Branches: TYPO3v4-5 trunk

Problem:
Since TYPO3 4.5 - if safe_mode is on - the thumbnail generation is broken once
again.
In File t3lib/utility/class.t3lib_utility_command.php the function
imageMagickCommand() uses escapeshellarg() which leads to broken command if
safe_mode is turned on.
With safe_mode on, exec() implicitly uses escapeshellcmd(). If wrong or no
locale is set, umlauts in command get lost leading to invalid command.
Since TYPO3 4.5 a wrapper function for exec() was introduced in file
t3lib/utility/class.t3lib_utility_command.php which does not set the locale at
all.

Solution:
Since escapeshellarg() was intended to be used on arguments it is simply the
wrong function here.
Using escapeshellcmd() instead of escapeshellarg() solves the problem with
broken command.
Applying a setlocale() if needed in function t3lib_utility_Command::exec()
solves problems with Umlauts in command.

See attached diff.

Best Regards,
Jan Radecker

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 17419.diff
Type: application/octet-stream
Size: 1353 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20110131/2ca5acff/attachment.obj>


More information about the TYPO3-team-core mailing list