Project

General

Profile

Actions

Bug #19501

closed

same key wrongly used in substituteMarkerArrayCached

Added by Franz Holzinger over 15 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2008-10-23
Due date:
% Done:

0%

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

Description

If you call substituteMarkerArrayCached twice with the same template part, and once you want to use

some text

First you set the $wrappedSubpartContentArray['###MYSUBPART###']='', $subpartContentArray=array(); where the other array keys remain the same.

Secondly you do the same call, however $wrappedSubpartContentArray=array() and
$subpartContentArray['###MYSUBPART###']=''

The second call will never do what you want, it gives you 'some text' instead of an empty string. This is because the function substituteMarkerArrayCached calculates the same cache although it has formerly been called with the same key set in $wrappedSubpartContentArray and not in $subpartContentArray

Solution:The keys of all arrays must not be merged to generate the md5 sum. It must be considered somewhere from which array a key comes from.

(issue imported from #M9631)

Actions #1

Updated by Alexander Opitz almost 11 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (0)

The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?

Actions #2

Updated by Franz Holzinger almost 11 years ago

The code of the method substituteMarkerArrayCached has been moved into
file ContentObjectRenderer.php.

The code looks unchanged. The problem remains the same.

// Finding keys and check hash:
$sPkeys = array_keys($subpartContentArray);
$wPkeys = array_keys($wrappedSubpartContentArray);
$aKeys = array_merge(array_keys($markContentArray), $sPkeys, $wPkeys);
Actions #3

Updated by Alexander Opitz almost 11 years ago

  • Status changed from Needs Feedback to New
Actions #4

Updated by Mathias Schreiber over 9 years ago

  • Status changed from New to Needs Feedback
  • Is Regression set to No

Since you dug so deep into the code, would you see the possibility to come up with a patch for this?

Actions #5

Updated by rengaw83 over 9 years ago

I dont have a patch at the moment, but i am using the rn_base extension since some years. There are the same function with some changes, which fixed this issue.

Have a look at https://github.com/rengaw83/rn_base/blob/master/util/class.tx_rnbase_util_Templates.php#L295

The reason is, how the md5 store key was created.
This should not created with a merge of the marker array keys.
The store key has to be created with all marker array keys itself.

old:

$storeKey =  md5('substituteMarkerArrayCached_storeKey:'.serialize(array($content, $aKeys)));

new can be:


$storeKey =  md5('substituteMarkerArrayCached_storeKey:'.serialize(array($content, $sPkeys, $wPkeys, array_keys($markContentArray))));

I hope it helps a little bit.

Actions #6

Updated by Alexander Opitz almost 9 years ago

  • Status changed from Needs Feedback to New
Actions #7

Updated by Daniel Goerz about 8 years ago

  • Status changed from New to Needs Feedback

This issue is very old. Is the bug still present in master and/or 7LTS?

Actions #8

Updated by Riccardo De Contardi almost 8 years ago

  • Category set to Content Rendering
Actions #9

Updated by Oliver Hader over 7 years ago

  • Status changed from Needs Feedback to Accepted

Behavior confirmed in master (CMS 8)

Actions #10

Updated by Gerrit Code Review over 7 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50098

Actions #11

Updated by Benni Mack over 6 years ago

  • Status changed from Under Review to New
Actions #12

Updated by Susanne Moog over 6 years ago

  • Category changed from Content Rendering to Frontend
Actions #13

Updated by Susanne Moog about 4 years ago

  • Status changed from New to Closed

Meanwhile, the method has been deprecated and removed.

Actions

Also available in: Atom PDF