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

History 34

  1. Benni Mack commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-01-23T21:15:08+00:00" > 01/23/26, 21:15 </span>

    Applied in changeset commit:7a3dea5df6dca51a0fb2eadbcce0b40ebb533e5d.