Issue Bug Closed

#109236Runtime Deprecation Notice in PersistedAliasMapper

Thomas Rawiel 03/13/26, 14:54 updated 03/31/26, 08:09

Description

For a TCA model without any language fields, the persisted alias mapper correctly identifies the $schema->isLanguageAware() == false

However, in the resolve function

TYPO3\CMS\Core\Routing\Aspect\PersistedAliasMapper:167

if (($result[$this->languageParentFieldName] ?? null) > 0) {
   return (string)$result[$this->languageParentFieldName];
}

throws
PHP Runtime Deprecation Notice: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/vendor/typo3/cms-core/Classes/Routing/Aspect/PersistedAliasMapper.php line 167

Something like

$field = $this->languageParentFieldName;
if ($field !== null && ($result[$field] ?? 0) > 0) {
  return (string)$result[$field];
}

should solve that

Reviews 2