Issue Bug Closed

#94154TypeError for missing transOrigPointerField field

Daniel Siepmann 05/18/21, 21:07 updated 07/18/21, 15:47

Description

A TypeError is thrown when accessing the list module with records that have a TCA entry with configured ctrl.languageField but without ctrl.transOrigPointerField.

(1/1) TypeError

Argument 1 passed to TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder::eq() must be of the type string, null given, called in /typo3/sysext/backend/Classes/Utility/BackendUtility.php on line 3207
in /typo3/sysext/core/Classes/Database/Query/Expression/ExpressionBuilder.php line 110

     * @param mixed $value The value. No automatic quoting/escaping is done.
     *
     * @return string
     */
    public function eq(string $fieldName, $value): string
    {
        return $this->comparison($this->connection->quoteIdentifier($fieldName), static::EQ, $value);
    }

at TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder->eq()
in /typo3/sysext/backend/Classes/Utility/BackendUtility.php line 3207

                ->from($table)
                ->where(
                    $queryBuilder->expr()->eq(
                        $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'],
                        $queryBuilder->createNamedParameter($ref, \PDO::PARAM_INT)
                    ),
                    $queryBuilder->expr()->neq(
                        $GLOBALS['TCA'][$table]['ctrl']['languageField'],
                        $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)

Looks like the if condition doesn’t work as expected:

        if ($GLOBALS['TCA'][$table]['ctrl']['languageField'] ?? null
            && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] ?? null
        ) {

Reviews 1