Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation and PHP Warning when invoking DataHandler via CLI #157

Open
ervaude opened this issue Aug 3, 2024 · 0 comments
Open

Deprecation and PHP Warning when invoking DataHandler via CLI #157

ervaude opened this issue Aug 3, 2024 · 0 comments

Comments

@ervaude
Copy link

ervaude commented Aug 3, 2024

Hi Nicole,
when invoking DataHandler via CLI (e.g. while importing with l10nmgr or something alike) the content_defender DataHandler Hook (\IchHabRecht\ContentDefender\Hooks\DatamapDataHandlerHook::processDatamap_beforeStart()) is called.

Inside the method isRecordAllowedByRestriction() the \TYPO3\CMS\Backend\Form\FormDataCompiler is called:

$formDataCompilerInput = [
    'command' => 'edit',
    'databaseRow' => $record,
    'effectivePid' => $record['pid'],
    'tableName' => 'tt_content',
    'vanillaUid' => (int)$record['uid'],
];
$result = $formDataCompiler->compile($formDataCompilerInput);

Due to the lack of a Request object, we run into the following lines of the compile() method:

if (!$result['request'] instanceof ServerRequestInterface) {
    // @deprecated since v12: Throw a \RuntimeException in v13 instead.
    trigger_error(
        'When using FormDataCompiler, the current ServerRequestInterface object must be provided.',
        E_USER_DEPRECATED
    );
    $result['request'] = $GLOBALS['TYPO3_REQUEST'];
}

This has been introduced with https://review.typo3.org/c/Packages/TYPO3.CMS/+/78609

Since there is no ServerRequestInterface in $result, we get a deprecation warning and since $GLOBALS['TYPO3_REQUEST'] is not set, we get a PHP warning on top.

This might be an issue in core, after all.

Anyway, thanks for your great extension.

Cheers
Daniel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant