Issue Bug Closed

#92105Wrong usage of array_diff inside TYPO3\CMS\Frontend\Utility\CanonicalizationUtility::getParamsToExcludeForCanonicalizedUrl

Oliver Büker 08/26/20, 13:25 updated 03/31/26, 09:00

Description

Hello TYPO3 Team,

as mentioned in the Subject, in this function the use off array_diff is wrong and array_diff_assoc should be used.

Example(pageId === values of other parameters):

URL Parameters id=7&bla=7&blub=7
$urlParameters = array(
   bla => '7' (1 chars)
   blub => '7' (1 chars)
   id => '7' (1 chars)

$paramsToExclude would be empty because, array_diff will test the value, but the key should be testet.
If the value is not the PageId array_diff will work, but not if the values are the same.

If array_diff_assoc would be used, then the result would be correct.

$paramsToExclude = Array(
  bla => 7, 
  blub => 7
)

Best Regards
Oliver Büker

Reviews 1