Project

General

Profile

Actions

Bug #53002

closed

Calculation of GIFBUILDER object properties using stdWrap fails

Added by Dan Kleine (Untenzu) over 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2013-10-21
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
Remote Sprint

Description

Hey,

I stumbled upon a juicy bug in GIFBUILDER which is somehow related to #41487.

Short description:
Whenever GIFBUILDER object properties are modified with stdWrap, they can not make use of calculations anymore. If calculations are used, they will fail (return wrong values).

Long description
An IMAGE-Object made with GIFBUILDER is requested. Lets say I use the offset-parameter and overwrite it, if a certain condition is met.

10 = IMAGE
10 {
    file = GIFBUILDER
    file {
        XY = 300,225
        format = jpg
        quality = 90

        10 = IMAGE
        10 {
            file = fileadmin/user_upload/someimage.png
            file.maxW = 640
            file.minW.override = 300
            offset = 300-[10.w]/2,225-[10.h]/2
            offset.override = 640-[10.w]/2,225-[10.h]/2
            offset.override.if.isTrue.field = tx_myext_somefield
        }
    }
}

This request calls GifBuilder->start() (see http://api.typo3.org/typo3cms/60/html/_gif_builder_8php_source.html). In this method some GifBuilder-properties like boundingbox, dimensions and offset will be calculated for the object itself, as well as for all child-objects (1,2,3,40,50,60… 10 in my case)

On line 268 the offset-properties is modified with stdWrap, if existing. The bug is caused here, but let's keep going. Now the calculations start, and will return correct values!

Next. In GifBuilder->make() the image is created and all GifBuilder-Objects are rendered. On line 406 »stdWrap« is applied again to every GifBuilder-Object. But the calculations are not repeated as required. The bug is now in effect, since the next method will simply do an intval() on the parameter and therefore cause wrong values.

In my example the offset-parameter will look like this:

(start) = 300-[10.w]/2,225-[10.h]/2
(override) = 640-[10.w]/2,225-[10.h]/2
(calc) = 150,75
(override again) = 640-[10.w]/2,225-[10.h]/2
(intval) = 640,225

Solution:
Either change the stdWrap-loop on line 406 and exclude all properties with calculations (offset,dimensions,set,…), or change the calculation-loop and unset all »[key].«-arrays.

I have a patch for the latter solution and can send it to gerrit.

The bug effects all TYPO3 versions since 4.5.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #41487: stdWrap executed twice on GIFBUILDER object propertiesClosed2012-10-01

Actions
Actions

Also available in: Atom PDF