same key wrongly used in substituteMarkerArrayCached
If you call substituteMarkerArrayCached twice with the same template part, and once you want to use
<!-- ###MYSUBPART### begin -->
<!-- ###MYSUBPART### end -->
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
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)
Updated by Franz Holzinger about 8 years ago
The code of the method substituteMarkerArrayCached has been moved into
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);
Updated by rengaw83 over 6 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.
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.
$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.