Placeholders - avoid infinite recursion if apps have custom fields of other apps

This commit is contained in:
nathan 2021-10-12 15:44:48 -06:00
parent 9e2bb05ded
commit 7dba4b9284

View File

@ -3079,6 +3079,12 @@ abstract class Merge
*/ */
protected function add_customfield_placeholders(&$placeholders, $prefix = '') protected function add_customfield_placeholders(&$placeholders, $prefix = '')
{ {
// Avoid recursing between custom fields of different apps
if(substr_count($prefix, '#') > 1)
{
return;
}
foreach(Customfields::get($this->get_app()) as $name => $field) foreach(Customfields::get($this->get_app()) as $name => $field)
{ {
if(array_key_exists($field['type'], Api\Link::app_list())) if(array_key_exists($field['type'], Api\Link::app_list()))
@ -3108,7 +3114,6 @@ abstract class Merge
public function get_placeholder_list($prefix = '') public function get_placeholder_list($prefix = '')
{ {
$placeholders = [ $placeholders = [
'placeholders' => []
]; ];
$this->add_customfield_placeholders($placeholders, $prefix); $this->add_customfield_placeholders($placeholders, $prefix);
@ -3212,7 +3217,6 @@ abstract class Merge
*/ */
public function show_replacements() public function show_replacements()
{ {
$template_name = 'api.show_replacements'; $template_name = 'api.show_replacements';
$content = $sel_options = $readonlys = $preserve = array(); $content = $sel_options = $readonlys = $preserve = array();