[TYPO3-core] RFC #14264: cObj + PHPunit - Problem with cwd

Susanne Moog info at susannemoog.de
Fri May 7 20:41:41 CEST 2010


Hi Stefan,

On 07.05.2010 10:31, Stefan Geith wrote:
> Hi Susanne,
> 
> Susanne Moog schrieb:
>> I'm sorry, but I don't get the problem / your solution. In your testcase
>> you compare $imgRes to $result[3] (which obviously can't work before
>> applying your second patch as there is no $result[3]):
> 
> Try testing Image-Rendering with a Testcase in PHPunit,
> e.g. cObj->IMAGE(Array('file'=>'typo3conf/ext/plugin/test.gif'))
> 
> This will not work because, PHPunit runs in a different working
> directory than the Typo3 FE. And cObj->IMAGE needs the relative
> path to the image in $info[3].
> 
> Tracking this, you will find out, that $result[3] is set by
> gifCreator->imageMagickConvert($theImage) but ONLY if paths
> are correct (=FE).
> 
> If I then change the (relative) pats to absolute paths,
> $result[3] also contains this absolute path, which would
> be false, because this value is used to render the <img>-tag.
> 
> Hope, this clarifies the problem a bit...

Yep, this clarifies the problem and I had a look but I'm afraid the fix
does not work fully. Your patch does:

$info = $gifCreator->imageMagickConvert($theImage,'WEB','','','','','');
$info[3] = $theImage;

This effectively overwrites the path to the generated image (which was
generated by $gifCreator->imageMagickConvert) with the old one. You can
test that flaw easily by setting this in your typoscript (and have
ghostscript installed):

page.40 = IMAGE
page.40.file = fileadmin/test.pdf

This will result in an image tag with a pdf file as src="". Without your
patch you get an image in typo3temp.

I'd rather suggest trying to fix this bug by finding the parts in
imageMagickConvert() that need the correct path and use the absolute
path there.

Thanks for your efforts,

Susanne


More information about the TYPO3-team-core mailing list