Why is there a problem with the conclusion of the snippets in MODX Revolution using chunks?

There is a MODX Revolution 2.7.1. Already far not the first time (and on previous versions of modx) there are problems with the output of snippets. I can not understand why "broken" the snippet and how to fix it.

Here is the code:
[[!getPage:empty=`<p>a List of the materials in this section are empty</p>`?
&elementClass=`modSnippet`
&element=`getResources`
&tpl=`mainNewsTpl`
&limit=`10`
&includeContent=`1`
&includeTVs=`1`
&parents=`[[*id]]`
&pageNavOuterTpl=`[[+prev]][[+pages]][[+next]]`
&pageNextTpl=`[[$pageNextTplCustom]]`
&pagePrevTpl=`[[$pagePrevTplCustom]]`
&hideContainers=`1`
 ]]


And here is what is displayed on the frontend:
5cc9d0346938d905320121.png

In this case all the parameters of the input snippet pulled and processed correctly, but often the processing of inputs is interrupted in a particular. Specifically, this project already time 4th there is a problem and I do not understand why. Who faced with and how it can be cured? In the database like everything is in the correct form and no structures that would facilitate such behavior snippet I do not watch.
March 20th 20 at 11:24
1 answer
March 20th 20 at 11:26
While temporarily "samstyle", I hope that the cause and solution there.

Created snippet "snippetRunner":
<?php
if(empty($snippet)){
return;
}

if(!empty($params)){
 $params = str_replace("`", "", $params);
 $params = json_decode($params, true);

 foreach($params as $key => $value){
 if(strpos($key, "htmldecode_") !== false){
 $params[str_replace("htmldecode_", "", $key)] = htmlspecialchars_decode($value);
}
}
}

$content = $modx->runSnippet($snippet !empty($params) ? $params : []);

return !empty($content) ? $content : (!empty($params["if_empty"]) ? $params["if_empty"] : "");


In the template prescribed:
[[!snippetRunner? &snippet=`getPage` &params=`{
 "elementClass":"modSnippet", 
 "element": "getResources", 
 "tpl": "mainNewsTpl", 
 "tvFilters":"tags==%[[!getRequestValue? &param=`tag`]]%",
 "limit": 10,
 "includeContent": 1,
 "includeTVs": 1,
 "hideContainers": 1,
 "parents": 2,
 "htmldecode_pageNavOuterTpl": "[[$pageNavOuterTplCustom:htmlent]]",
 "htmldecode_pageNextTpl": "[[$pageNextTplCustom:htmlent]]",
 "htmldecode_pagePrevTpl": "[[$pagePrevTplCustom:htmlent]]",
 "if_empty": "<p>a list of the materials in this section blank.</p>"
}`
 ]]

Find more questions by tags MODX