Bug #24956

GifBuilder - meaningfulTempFilePrefix can cause invalid image urls

Added by Philipp Mueller over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
Start date:
2011-02-04
Due date:
% Done:

0%

TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hello

I use the GIFBUILDER to generate a Menu with a dynamic text (pagename). If a pagename includes a slash (/) the image-generation will fail, if "meaningfulTempFilePrefix" is activated.

The Problem is the slash in the pagename, which will not be converted for the filename-generation.

Error-message:
Core: Error handler (FE): PHP Warning: imagepng(): Unable to open 'typo3temp/GB/Service/Support_navbg_51124ff245_97eff91762.png' for writing: No such file or directory in /usr/share/typo3/source/typo3_src-4.5.0/t3lib/class.t3lib_stdgraphic.php line 2899

To fix the bug, replace the line 720 in typo3/sysext/cms/tslib/class.tslib_gifbuilder.php:

original line:
$meaningfulPrefix = str_replace(' ', '_', $meaningfulPrefix);

fixed line:
$meaningfulPrefix = str_replace(array(' ','/'), '_', $meaningfulPrefix);

Regards Philipp

(issue imported from #M17483)

17483_v1.diff View (877 Bytes) Administrator Admin, 2011-02-08 20:47

History

#1 Updated by Philipp Mueller over 8 years ago

Sorry, wrong category. Move it to "TYPO3 Core" please.

#2 Updated by Stefan Galinski over 8 years ago

Hi Philipp,

Thanks for the initial idea! I changed the line to whitelist allowed characters instead of blacklist them.

Test-TS:

config.meaningfulTempFilePrefix = 100

page = PAGE
page.10 = COA
page.10 {
10 = IMAGE
10 {
file = GIFBUILDER
file {
XY = 200,30
transparentBackground = 1
format = png
backColor = #000000

15 = TEXT
15 {
text = täst/123$?&%-_.+!*
fontColor = #FFFFFF
fontSize = 24
offset=0,24
}
}
}
}

#3 Updated by Stefan Galinski over 8 years ago

Committed in:
rev 10552 (trunk)
rev 10553 (4.5)

Also available in: Atom PDF