xperseguers / t3ext-ig_ldap_sso_auth

TYPO3 Extension ig_ldap_sso_auth. This extension provides LDAP and SSO support for TYPO3.

Home Page:https://extensions.typo3.org/extension/ig_ldap_sso_auth

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PSR-7 request is missing in ContentObjectRenderer (PHP 8.2)

klodeckl opened this issue · comments

Hello,

after updating TYPO3 from 10 to 11 AND PHP 7.4 to 8.2 I get the following error message when logging in with an ldap user:
Wed, 21 Jun 2023 14:44:43 +0000 [CRITICAL] request="f3e05de6e86ad" component="TYPO3.CMS.Core.Error.ProductionExceptionHandler": Core: Exception handler (WEB: BE): TYPO3\CMS\Frontend\ContentObject\Exception\ContentRenderingException, code #1607172972, file /var/www/typo3/typo3_src-11.5.27/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php, line 6891: PSR-7 request is missing in ContentObjectRenderer. Inject with start(), setRequest() or provide via $GLOBALS['TYPO3_REQUEST']. - {"mode":"WEB","application_mode":"BE","exception_class":"TYPO3\\CMS\\Frontend\\ContentObject\\Exception\\ContentRenderingException","exception_code":1607172972,"file":"/var/www/typo3/typo3_src-11.5.27/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php","line":6891,"message":"PSR-7 request is missing in ContentObjectRenderer. Inject with start(), setRequest() or provide via $GLOBALS['TYPO3_REQUEST'].","request_url":"https://dev4.oth-aw.de/myoth/?tx_felogin_login%5Baction%5D=login&tx_felogin_login%5Bcontroller%5D=Login&cHash=86d4de0de1a88e642be41dc90bbdd439","exception":null}

I checked the code and it seems to be related to:
$value = $contentObj->stdWrap($value, $mapping[$typoScriptKey]);
(in public static function merge, line 753 of Classes/Library/Authentication.php using the current main branch of ig_ldap_sso_auth (stable release has the same error))

After commenting the line the error is gone (but some mapping is now wrong or not working?). I didn’t understand the problem because a few lines before there is already
$contentObj->start($flattenedLdap, '');
but it seems to have no effect.

Maybe this is related to PHP 8.2?

Problem seems to be gone. Maybe it was an autoload issue.

Problem again. How can I fix that? Non composer installation. Dump autoload does not help.

I found out the problem. I have a field mapping like this:

noticeboardcourseabo {
cObject = USER
cObject.userFunc = VENDOR\Extensionname\Usersync->initialCourseSync
}

It seems I have to build a hook marker instead :(

Yes, looks like having a USER invokes the usage of a "global" contentObjectRenderer and we instantiate a local one.

I don't want to try to fiddle with instantiating a global content object renderer. If USER is really what you need, maybe you could find a way to "hook" into that process and instantiate it on your own right before the mapping takes place (did not check if there's a hook/PSR you could use).

Closing as too edge-case, having a mapping is already cool enough, but not used by everyone and trying to support such edge-case is too error-prone and will lead to too much headache in future to keep compatibility.