Project

General

Profile

Actions

Bug #19156

closed

functions in interface.tslib_content_stdwraphook.php gets executed numerous times.

Added by Peter Klein over 16 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2008-07-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I was using /sysext/cms/tslib/interfaces/interface.tslib_content_stdwraphook.php to extend stdWrap with some extra functionality, when I discovered a weird problem.

When i have 1 content elemnt on my page it works fine, but when there 2 CEs, my extended stdWrap command gets executed twice. With 3 CEs, its executed 3 times and so on.

I then tried using a userFunc instead, which worked perfectly (only executed once for each CE).

Attached is a simple extension that illustrates the problem.
Just install it, and include the static template.

The static template consists of this TS code:
tt_content.text.20.stdWrapHookBug = 1
tt_content.text.20.postUserFunc = user_stdWrapHookBug

(issue imported from #M9058)


Files

T3X_stdwraphookbug-0_0_0-z-200807261857.t3x (1.86 KB) T3X_stdwraphookbug-0_0_0-z-200807261857.t3x Administrator Admin, 2008-07-26 18:54
bug_9058.diff (716 Bytes) bug_9058.diff Administrator Admin, 2009-11-18 16:18
bug_9058_v2.diff (580 Bytes) bug_9058_v2.diff Administrator Admin, 2009-11-18 17:54
Actions #1

Updated by Peter Klein over 16 years ago

I forgot to mention, that after installing the test extension, you should try viewing a page with multiple text CEs in the Frontend.

Actions #2

Updated by Peter Klein over 16 years ago

A related problem is also visible when installing the test plugin.

Notice that the "stdWrapPreProcess" function never gets executed.. (The text from that function should have be displayed in red color.)

Actions #3

Updated by Peter Klein over 16 years ago

Partial solution:
If I in the file "class.tslib_content.php", in the function "start", clear the "stdWrapHookObjects " by inserting this in line 363.

$this->stdWrapHookObjects = array();

Then the 1st problem seems to be solved. (But still no output from the "stdWrapPreProcess" function.

Actions #4

Updated by Adrian Föder about 15 years ago

Having exactly the same issue. The problem seems to be clear: due to not resetting the $this->stdWrapHookObjects array in the start() function, the function collects the same call each time when a CONTENT object is created.

Unfortunately the stdWrapHookObjects array is "protected" so we are unable to "clean" this problem via our extension...

Actions #5

Updated by Steffen Müller about 15 years ago

I created a patch to solve the original issue. It applies to 4.3-rc1 and hopefully we still get this into 4.3

Actions #6

Updated by Steffen Müller about 15 years ago

The second problem:

The content from stdWrapPreProcess is overriden by
if ($conf['field']) {$content=$this->getFieldVal($conf['field']);}
which is a few lines below the stdWrapPreProcess hook.

As you can see, $content is filled with the value of the field 'bodytext', because we have
tt.content.text.20.field = bodytext

I'm not sure if this is the expected behavior or a bug. If it's expected behavior, we should remove $content from the stdWrapPreProcess hook.

Update: I'd propose to open a new bug for this issue.

Actions #7

Updated by Steffen Kamper almost 15 years ago

Committed to trunk, rev 6545

Actions

Also available in: Atom PDF