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

Exception: Call to a member function sL() on null #10

Closed
kitzberger opened this issue Jul 28, 2021 · 1 comment · Fixed by #11
Closed

Exception: Call to a member function sL() on null #10

kitzberger opened this issue Jul 28, 2021 · 1 comment · Fixed by #11

Comments

@kitzberger
Copy link
Contributor

With 2.0.2 I've got this exception now. Can't say why this is happening now and not before when working on #8 ;-/

Bildschirmfoto vom 2021-07-28 12-04-58

@schloram
Copy link
Member

Hi @kitzberger ,
thanks again.

I should have realized that when reviewing the PR. $GLOBALS['LANG'] is only for backend or CLI purposes.

Usually this is injected into $GLOBALS['LANG'] when in backend or CLI context, and populated by the current backend user. Don't rely on $GLOBAL['LANG'] in frontend, as it is only available in certain circumstances! In Frontend, this is also used to translate "labels", see TypoScriptFrontendController->sL() for that.

see: https://api.typo3.org/10.4/class_t_y_p_o3_1_1_c_m_s_1_1_core_1_1_localization_1_1_language_service.html

This explains why it sometimes works and sometimes it doesn't.

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 a pull request may close this issue.

2 participants