Bug #41487
closedstdWrap executed twice on GIFBUILDER object properties
100%
Description
This is an intentional duplicate of #25189 to boil down all the findings and discussions and make it easier to see the basic problem and its solution.
Problem¶
The result of the following TS is a GIF containing the text AAfooBB instead of AfooB.
page.100 = IMAGE page.100 { file = GIFBUILDER file { 10 = TEXT 10{ offset = 0,20 text = foo text.wrap = A|B } } }
Deeper analysis of the bug shows that all stdWraps of all properties of TEXT objects in GIFBUILDER are done twice!
This double stdWrapping affects GIFBUILDER as well as GMENU objects.
The bug is present in all current versions from 4.5 LTS to 4.7.
Background¶
This bug was introduced during the extensive overhaul of stdWrap from TYPO3 v4.4 to v4.5.
In the course of this overhaul a great number of stdWrap calls that were spread all over class.tslib_gifbuilder.php have been condensed down into one central stdWrap loop in the tslib_gifBuilder->make() method.
Additionally an identical stdWrap loop was added to tslib_gifBuilder->checkTextObj(). checkTextObj is ONLY called for TEXT objects (as its name implies). checkTextObj() is executed much earlier in the GIFBILDER process than make(), and the reason for having a preliminary stdWrapping there-in is to provide correctly wrapped values for the initial math of all the properties of TEXT objects (like the text width and so on). So this exception is definitely necessary.
In the final make() function the stdWrap loop is executed again for ALL object types. This results in a double wrapping for all TEXT objects.
Solution¶
The stdWrapping in make() should happen only for objects that are non-TEXT, as TEXT objects have already been stdWrapped in checkTextObj(). An additional if-condition around the stdWrap loop in make() solves the bug easily (see attached patch).
Files
Updated by Jörg Wagner over 11 years ago
Updated by Jörg Wagner over 11 years ago
Original and patched file were exchanged in my first upload. Here is the correct patch!
Updated by Gerrit Code Review over 11 years ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/15403
Updated by Gerrit Code Review over 11 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/15403
Updated by Gerrit Code Review over 11 years ago
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16865
Updated by Gerrit Code Review almost 11 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/16865
Updated by Gerrit Code Review almost 11 years ago
Patch set 1 for branch TYPO3_6-1 has been pushed to the review server.
It is available at https://review.typo3.org/20529
Updated by Gerrit Code Review almost 11 years ago
Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/20530
Updated by Gerrit Code Review almost 11 years ago
Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at https://review.typo3.org/20531
Updated by Gerrit Code Review almost 11 years ago
Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at https://review.typo3.org/20532
Updated by Jörg Wagner almost 11 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 6a3472a055ea1cd1802a9a6195f00d49c34400fa.
Updated by Gerrit Code Review almost 11 years ago
- Status changed from Resolved to Under Review
Patch set 2 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/20530
Updated by Jörg Wagner almost 11 years ago
- Status changed from Under Review to Resolved
Applied in changeset 6ebfaf73e25eb64288734f1cf0cfaab2698553ef.
Updated by Gerrit Code Review over 10 years ago
- Status changed from Resolved to Under Review
Patch set 2 for branch TYPO3_4-5 has been pushed to the review server.
It is available at https://review.typo3.org/20532
Updated by Gerrit Code Review over 10 years ago
Patch set 2 for branch TYPO3_4-7 has been pushed to the review server.
It is available at https://review.typo3.org/20531
Updated by Jörg Wagner over 10 years ago
- Status changed from Under Review to Resolved
Applied in changeset 46ae61c060dace21b15dd90ffa7115113a31fae1.