Issue Bug New

#111639PersistedPatternMapper::resolve() uses null as array offset for tables without language support (PHP 8.5 deprecation)

David CADU 11/27/26, 11:38 updated 11/27/26, 11:38

Description

When a PersistedPatternMapper aspect is configured for a table that has no language capability in TCA (no languageField / transOrigPointerField), every URL resolution triggers a PHP 8.5 deprecation:

PHP Runtime Deprecation Notice: Using null as an array offset is deprecated, use an empty string instead in typo3/sysext/core/Classes/Routing/Aspect/PersistedPatternMapper.php line 168

In this case, $this->languageParentFieldName is set to null in the constructor, but resolve() uses it as an array key without checking it:

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

The ?? null operator does not prevent the deprecation, because the problem is the null key itself, not a missing array entry.

Steps to reproduce
  1. Use PHP 8.5.
  2. Create a table without language fields in its TCA.
  3. Configure a route enhancer with a PersistedPatternMapper aspect on this table, for example:
aspects:
  record:
    type: PersistedPatternMapper
    tableName: tx_myext_domain_model_item
    routeFieldPattern: '^(?P<uid>\d+)-(?P<slug>.+)$'
    routeFieldResult: '{uid}-{slug}'
  1. Open a detail page using this route. The deprecation above is logged.

Suggested fix

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

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] PersistedPatternMapper::resolve() uses null as array offset for tables without language support (PHP 8.5 deprecation) Resolves: #111639 Releases: main