Skip to content

[CLEANUP] ignore php warning if no page is selected via the page tree #557

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dontWatchMeCode
Copy link

Screenshot from 2024-08-12 12-35-45

reproduce:

  • delete the pid query param / open the BE and directly go to the Cart BE Modules

Best regards.

@rintisch
Copy link
Collaborator

@dontWatchMeCode maybe I missed something so therefore: Why did you add a @ before the $this?

@dontWatchMeCode
Copy link
Author

dontWatchMeCode commented Aug 13, 2024

Ignores the warning thrown if the array key is not set:

https://www.php.net/manual/en/language.operators.errorcontrol.php (Error Control Operators)

Since the value is set to PID 1 and the warning isn't needed.

@rintisch
Copy link
Collaborator

Interesting. Thanks for the input. It's not me to decide whether to go this way but: I cannot reproduce this error at all.

@rintisch
Copy link
Collaborator

Wait... I really need to setup a extra TYPO3 for the EXT:cart stuff...

@rintisch
Copy link
Collaborator

rintisch commented Aug 13, 2024

I can imagine that @extcode prefers something like

$pageId = isset($this->request->getQueryParams()['id']) ? (int)$this->request->getQueryParams()['id'] : 1;

to not block warning that we are not expecting at the moment.

@dontWatchMeCode
Copy link
Author

dontWatchMeCode commented Aug 13, 2024

Thanks,

i'm using PHP 8.1 with t3 v12 and error reporting in dev mode.

Maybe an older PHP Version or t3 set to ignore warnings?

isset(... should still throw an error.

array_key_exists('id', $this->request->getQueryParams()) ... should work as an alternative to @.

@rintisch
Copy link
Collaborator

Yes, I meant with "wait..." that I had a wrong configuration. Now I can reproduce the error. But it's solved with the code snippet that I wrote above.

@extcode extcode self-assigned this Aug 22, 2024
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

Successfully merging this pull request may close these issues.

3 participants