Issue Story Closed

#106837PHP Deprecation Table::$isNameInitialized

Franz Holzinger 06/05/25, 17:38 updated 06/05/25, 20:28

Description

TYPO3 Version 13.4.14-dev
The backend login database connection fails due to this PHP Deprecation:

(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception
PHP Runtime Deprecation Notice: Creation of dynamic property Doctrine\DBAL\Schema\Table::$isNameInitialized is deprecated in /path/vendor/typo3/cms-core/Classes/Cache/Frontend/VariableFrontend.php line 85

in /path/vendor/typo3/cms-core/Classes/Error/ErrorHandler.php line 141
        }

        $message = self::ERROR_LEVEL_LABELS[$errorLevel] . ': ' . $errorMessage . ' in ' . $errorFile . ' line ' . $errorLine;
        if ($errorLevel & $this->exceptionalErrors) {
            throw new Exception($message, 1476107295);
        }

        $message = $this->getFormattedLogMessage($message);

at TYPO3\CMS\Core\Error\ErrorHandler->handleError()
at unserialize()
in /path/vendor/typo3/cms-core/Classes/Cache/Frontend/VariableFrontend.php line 85
        $rawResult = $this->backend->get($entryIdentifier);
        if ($rawResult === false) {
            return false;
        }
        return $this->backend instanceof TransientBackendInterface ? $rawResult : unserialize($rawResult);
    }
}
at TYPO3\CMS\Core\Cache\Frontend\VariableFrontend->get()
in /path/vendor/typo3/cms-core/Classes/Database/Schema/SchemaInformation.php line 95
     */
    public function introspectTable(string $tableName): Table
    {
        $identifier = $this->connectionIdentifier . '-table-' . $tableName;
        $table = $this->cache->get($identifier);
        if ($table instanceof Table) {
            return $table;
        }
        $table = $this->connection->createSchemaManager()->introspectTable($tableName);
at TYPO3\CMS\Core\Database\Schema\SchemaInformation->introspectTable()
in /path/vendor/typo3/cms-core/Classes/Database/Connection.php line 416
    protected function ensureDatabaseValueTypes(string $tableName, array &$data, array &$types): void
    {
        // If types are incoming already (meaning they're hand over to insert() for instance), don't auto-set them.
        $setAllTypes = $types === [];
        $tableDetails = $this->getSchemaInformation()->introspectTable($tableName);
        $databasePlatform = $this->getDatabasePlatform();
        array_walk($data, function (mixed &$value, string $key) use ($tableDetails, $setAllTypes, &$types, $databasePlatform): void {
            $typeName = ($types[$key] ?? '');
            if (!$setAllTypes && is_string($typeName) && $typeName !== '' && Type::hasType($typeName)) {
at TYPO3\CMS\Core\Database\Connection->ensureDatabaseValueTypes()
in /path/vendor/typo3/cms-core/Classes/Database/Connection.php line 192
     * @return int The number of affected rows.
     */
    public function insert(string $tableName, array $data, array $types = []): int
    {
        $this->ensureDatabaseValueTypes($tableName, $data, $types);
        return parent::insert(
            $this->quoteIdentifier($tableName),
            $this->quoteColumnValuePairs($data),
            $this->quoteColumnTypes($types)
at TYPO3\CMS\Core\Database\Connection->insert()
in /path/vendor/typo3/cms-core/Classes/Session/Backend/DatabaseSessionBackend.php line 137
        $sessionData['ses_id'] = $sessionId;
        $sessionData['ses_tstamp'] = $GLOBALS['EXEC_TIME'] ?? time();

        try {
            $this->getConnection()->insert(
                $this->configuration['table'],
                $sessionData,
                ['ses_data' => Connection::PARAM_LOB]
            );
at TYPO3\CMS\Core\Session\Backend\DatabaseSessionBackend->set()
in /path/vendor/typo3/cms-core/Classes/Session/UserSessionManager.php line 201
        ];
        if ($isPermanent) {
            $sessionRecord['ses_permanent'] = 1;
        }
        $sessionRecord = $this->sessionBackend->set($sessionId, $sessionRecord);
        return UserSession::createFromRecord($sessionId, $sessionRecord, true);
    }

    /**
at TYPO3\CMS\Core\Session\UserSessionManager->elevateToFixatedUserSession()
in /path/vendor/typo3/cms-core/Classes/Authentication/AbstractUserAuthentication.php line 765
        if (!isset($this->userSessionManager)) {
            $this->initializeUserSessionManager();
        }
        $userRecordCandidateId = (int)($userRecordCandidate[$this->userid_column] ?? 0);
        $session = $this->userSessionManager->elevateToFixatedUserSession($this->userSession, $userRecordCandidateId);
        // Updating lastLogin_column carrying information about last login.
        $this->updateLoginTimestamp($userRecordCandidateId);
        return $session;
    }
at TYPO3\CMS\Core\Authentication\AbstractUserAuthentication->createUserSession()
in /path/vendor/typo3/cms-core/Classes/Authentication/AbstractUserAuthentication.php line 559
                || (int)($userRecordCandidate[$this->userid_column] ?? 0) !== $this->userSession->getUserId()
            ) {
                $sessionData = $this->userSession->getData();
                // Create a new session with a fixated user
                $this->userSession = $this->createUserSession($userRecordCandidate);

                // Preserve session data on login
                if ($anonymousSession || $isExistingSession) {
                    $this->userSession->overrideData($sessionData);
at TYPO3\CMS\Core\Authentication\AbstractUserAuthentication->checkAuthentication()
in /path/vendor/typo3/cms-core/Classes/Authentication/AbstractUserAuthentication.php line 282

        // Load user session, check to see if anyone has submitted login-information and if so authenticate
        // the user with the session. $this->user[uid] may be used to write log...
        try {
            $this->checkAuthentication($request);
        } catch (MfaRequiredException $mfaRequiredException) {
            // Ensure the cookie is still set to keep the user session available
            if ($this->shallSetSessionCookie()) {
                $this->setSessionCookie();
at TYPO3\CMS\Core\Authentication\AbstractUserAuthentication->start()
in /path/vendor/typo3/cms-backend/Classes/Middleware/BackendUserAuthenticator.php line 99
        $rateLimiter = $this->ensureLoginRateLimit($GLOBALS['BE_USER'], $request);
        // Whether multi-factor authentication is requested
        $mfaRequested = $route->getOption('_identifier') === 'auth_mfa';
        try {
            $GLOBALS['BE_USER']->start($request);
        } catch (MfaRequiredException $mfaRequiredException) {
            // If MFA is required and we are not already on the "auth_mfa"
            // route, force the user to it for further authentication.
            if (!$mfaRequested && $this->isLoggedInBackendUserRequired($route)) {
at TYPO3\CMS\Backend\Middleware\BackendUserAuthenticator->process()
in /path/vendor/typo3/cms-core/Classes/Http/MiddlewareDispatcher.php line 162

                if (!$middleware instanceof MiddlewareInterface) {
                    throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
                }
                return $middleware->process($request, $this->next);
            }
        };
    }
}
at Psr\Http\Server\RequestHandlerInterface@anonymous/path/vendor/typo3/cms-core/Classes/Http/MiddlewareDispatcher.php:128$50->handle()
in /path/vendor/typo3/cms-reactions/Classes/Http/Middleware/ReactionResolver.php line 57
        // 1. We only listen to the "reaction" endpoint
        /** @var RouteResult $routeResult */
        $routeResult = $request->getAttribute('routing');
        if (!($routeResult instanceof RouteResult) || $routeResult->getRouteName() !== 'reaction') {
            return $handler->handle($request);
        }

        // 2. Security check
        $reactionIdentifier = (string)($routeResult->getArguments()['reactionIdentifier'] ?? '');
at TYPO3\CMS\Reactions\Http\Middleware\ReactionResolver->process()
in /path/vendor/typo3/cms-core/Classes/Http/MiddlewareDispatcher.php line 162

                if (!$middleware instanceof MiddlewareInterface) {
                    throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
                }
                return $middleware->process($request, $this->next);
            }
        };
    }
}
at Psr\Http\Server\RequestHandlerInterface@anonymous/path/vendor/typo3/cms-core/Classes/Http/MiddlewareDispatcher.php:128$50->handle()
in /path/vendor/typo3/cms-core/Classes/Middleware/RequestTokenMiddleware.php line 71
            $this->securityAspect->setReceivedRequestToken(false);
            $this->logger->debug('Could not resolve request token', ['exception' => $exception]);
        }

        $response = $handler->handle($request);
        return $this->enrichResponseWithCookie($request, $response);
    }

    protected function resolveNoncePool(ServerRequestInterface $request): NoncePool
at TYPO3\CMS\Core\Middleware\RequestTokenMiddleware->process()
in /path/vendor/typo3/cms-core/Classes/Http/MiddlewareDispatcher.php line 162

                if (!$middleware instanceof MiddlewareInterface) {
                    throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
                }
                return $middleware->process($request, $this->next);
            }
        };
    }
}
at Psr\Http\Server\RequestHandlerInterface@anonymous/path/vendor/typo3/cms-core/Classes/Http/MiddlewareDispatcher.php:128$50->handle()
in /path/vendor/typo3/cms-backend/Classes/Middleware/BackendRouteInitialization.php line 78
            $uri = $this->uriBuilder->buildUriFromRoute('login');
            return new RedirectResponse($uri);
        }

        return $handler->handle($request);
    }
}
at TYPO3\CMS\Backend\Middleware\BackendRouteInitialization->process()
in /path/vendor/typo3/cms-core/Classes/Http/MiddlewareDispatcher.php line 162

                if (!$middleware instanceof MiddlewareInterface) {
                    throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
                }
                return $middleware->process($request, $this->next);
            }
        };
    }
}
at Psr\Http\Server\RequestHandlerInterface@anonymous/path/vendor/typo3/cms-core/Classes/Http/MiddlewareDispatcher.php:128$50->handle()
in /path/vendor/typo3/cms-backend/Classes/Middleware/ContentSecurityPolicyReporter.php line 45
            // @todo create report, then call persist, then dispatch new event
            $this->persistCspReport($scope, $request);
            return (new Response())->withStatus(201);
        }
        return $handler->handle($request);
    }
}

This has worked before I did a downgrade in the Doctrine:

composer require doctrine/dbal“4.2.1”

- Downgrading doctrine/dbal (4.3.x-dev 44ea885 => 4.2.1)

Reviews 0

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