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

[BUG] TYPO3_REQUEST not available in CLI context (TYPO3 12) #30

Closed
3l73 opened this issue Mar 14, 2024 · 3 comments
Closed

[BUG] TYPO3_REQUEST not available in CLI context (TYPO3 12) #30

3l73 opened this issue Mar 14, 2024 · 3 comments
Labels
bug Something isn't working solved Issue resolved e.g. in a special branch

Comments

@3l73
Copy link
Contributor

3l73 commented Mar 14, 2024

Summary / Description

The global variable TYPO3_REQUEST is accessed without checking the existence.
After that the request ist used to retrieve the query parameters.

Within the CLI context this leads to the exception:
Call to a member function getQueryParams() on null

See: Classes/DataHandler/ProcessCmdmap.php

Version

development branch for TYPO3 12

Steps to reproduce

Expected behaviour

The command map should not be executed.

Actual behavior

The CLI command will leads to an exception.

Additional

Possible fix

Check if the server request is available or stop processing

$request = $GLOBALS['TYPO3_REQUEST'] ?? null;
if (!($request instanceof ServerRequestInterface)) {
           return;
}
$queryParams = $request->getQueryParams();
@3l73 3l73 added the bug Something isn't working label Mar 14, 2024
@3l73 3l73 changed the title [BUG] TYPO3_REQUEST not available in CLI context [BUG] TYPO3_REQUEST not available in CLI context (TYPO3 12) Mar 14, 2024
3l73 added a commit to 3l73/paste_reference that referenced this issue Mar 14, 2024
Verify that the global Variable exists and is of type ServerRequestInterface before using it.

The command map will exit in case that the request is not available.

Refs: Kephson#30
@Kephson
Copy link
Owner

Kephson commented Apr 3, 2024

Hi, I merged your pull request and will close the ticket afters test is successfull.

@Kephson Kephson added the solved Issue resolved e.g. in a special branch label Aug 23, 2024
@DavidBruchmann
Copy link
Collaborator

@Kephson can this issue be closed?

@Kephson
Copy link
Owner

Kephson commented Oct 10, 2024

Yes, we can close it, because it is resolved in the latest main branch and the v12 branch.

@Kephson Kephson closed this as completed Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working solved Issue resolved e.g. in a special branch
Projects
None yet
Development

No branches or pull requests

3 participants