Skip to content

Commit

Permalink
[TASK] Use null coalescing operator for userfunction's configuration
Browse files Browse the repository at this point in the history
Call the user functions with an empty array instead of null as 2nd
argument.

Resolves: #93513
Releases: master, 10.4
Change-Id: Ibc50b9e3ec7defc0100e5ae6447b05fca8e77cd7
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/68168
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
georgringer authored and bmack committed Mar 2, 2021
1 parent 33b2f64 commit f74189d
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -1517,7 +1517,7 @@ public function stdWrap_numRows($content = '', $conf = [])
*/
public function stdWrap_preUserFunc($content = '', $conf = [])
{
return $this->callUserFunction($conf['preUserFunc'], $conf['preUserFunc.'], $content);
return $this->callUserFunction($conf['preUserFunc'], $conf['preUserFunc.'] ?? [], $content);
}

/**
Expand Down Expand Up @@ -2452,7 +2452,7 @@ public function stdWrap_insertData($content = '')
*/
public function stdWrap_postUserFunc($content = '', $conf = [])
{
return $this->callUserFunction($conf['postUserFunc'], $conf['postUserFunc.'], $content);
return $this->callUserFunction($conf['postUserFunc'], $conf['postUserFunc.'] ?? [], $content);
}

/**
Expand Down Expand Up @@ -3493,7 +3493,7 @@ public function _parseFunc($theValue, $conf)
}
// userFunc
if ($conf['userFunc'] ?? false) {
$data = $this->callUserFunction($conf['userFunc'], $conf['userFunc.'], $data);
$data = $this->callUserFunction($conf['userFunc'], $conf['userFunc.'] ?? [], $data);
}
// Makelinks: (Before search-words as we need the links to be generated when searchwords go on...!)
if ($conf['makelinks'] ?? false) {
Expand Down Expand Up @@ -3655,7 +3655,7 @@ public function _parseFunc($theValue, $conf)
}
// userFunc
if (!empty($conf['nonTypoTagUserFunc'])) {
$contentAccum[$a] = $this->callUserFunction($conf['nonTypoTagUserFunc'], $conf['nonTypoTagUserFunc.'], (string)($contentAccum[$a] ?? ''));
$contentAccum[$a] = $this->callUserFunction($conf['nonTypoTagUserFunc'], $conf['nonTypoTagUserFunc.'] ?? [], (string)($contentAccum[$a] ?? ''));
}
}
}
Expand Down Expand Up @@ -4763,7 +4763,7 @@ public function typoLink($linkText, $conf)
// Call user function:
if ($conf['userFunc'] ?? false) {
$finalTagParts['TAG'] = $finalAnchorTag;
$finalAnchorTag = $this->callUserFunction($conf['userFunc'], $conf['userFunc.'], $finalTagParts);
$finalAnchorTag = $this->callUserFunction($conf['userFunc'], $conf['userFunc.'] ?? [], $finalTagParts);
}

// Hook: Call post processing function for link rendering:
Expand Down

0 comments on commit f74189d

Please sign in to comment.