Issue Bug Rejected

#87315TypeError in RecordStateFactory

Daniel Siepmann 01/02/19, 07:27 updated 01/02/19, 20:56

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()
        );
    }

    /**

Reviews 0

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