Bug #87315

TypeError in RecordStateFactory

Added by Daniel Siepmann 11 months ago. Updated 11 months ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-01-02
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

$this->resolveAspectFieldNames() may return null instead of empty strings, but only strings are accepted in array_map callback function within resolveAspectFieldValues, leading to an TypeError with PHP 7.2.

Stacktrace:


(1/1) TypeError

Argument 1 passed to TYPO3\CMS\Core\DataHandling\Model\RecordStateFactory::TYPO3\CMS\Core\DataHandling\Model\{closure}() must be of the type string, null given
in /home/daniels/Projects/company/example-project/htdocs/web/typo3/sysext/core/Classes/DataHandling/Model/RecordStateFactory.php line 103

     */
    protected function resolveAspectFieldValues(array $data): array
    {
        return array_map(
            function (string $aspectFieldName) use ($data) {
                return (int)($data[$aspectFieldName] ?? 0);
            },
            $this->resolveAspectFieldNames()
        );

at TYPO3\CMS\Core\DataHandling\Model\RecordStateFactory->TYPO3\CMS\Core\DataHandling\Model\{closure}(null)
at array_map(object(Closure), array('workspace' => 't3ver_wsid', 'versionParent' => 't3ver_oid', 'language' => 'sys_language_uid', 'languageParent' => 'l10n_parent', 'languageSource' => null))
in /home/daniels/Projects/company/example-project/htdocs/web/typo3/sysext/core/Classes/DataHandling/Model/RecordStateFactory.php line 106

        return array_map(
            function (string $aspectFieldName) use ($data) {
                return (int)($data[$aspectFieldName] ?? 0);
            },
            $this->resolveAspectFieldNames()
        );
    }

    /**


Related issues

Duplicates TYPO3 Core - Bug #86809: Resolve strict type assertion in RecordStateFactory Closed 2018-10-31

History

#1 Updated by Georg Ringer 11 months ago

  • Status changed from New to Rejected

closed as duplicate of #86809

#2 Updated by Georg Ringer 11 months ago

  • Duplicates Bug #86809: Resolve strict type assertion in RecordStateFactory added

Also available in: Atom PDF