Bug #94701
closed
Dashboard breaks if Guzzle Middleware is used
Added by David Bruchmann over 3 years ago.
Updated over 3 years ago.
Description
If a Guzzle Middleware is used the Dashboard modules "TYPO3 news" and "TYPO3 security advisories" do not work anymore.
Related to that might be that $GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler'] is handled somehow strange, the values are not visible always and in the backend Configuration Module it looks always empty.
Files
- Status changed from New to Needs Feedback
Hey David,
can you give a few more details?
a) Do you push a middleware from which Guzzle package to TYPO3's middleware stack?
b) Or are you using a custom handler for TYPO3_CONF_VARS[HTTP]?
Can you give me a few steps on how to reproduce your issue?
thanks in advance,
benni.
Hi Benni,
thanks for the quick answer.
The attached extension can be installed to reproduce the issue, it's limited to the most important settings.
I use ext_localconf.php to add the Handler to $GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler'], so I don't "push a middleware from which Guzzle package to TYPO3's middleware stack".
Dependency injection like shown in the manual doesn't work, but I think in my example it's not relevant.
https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ApiOverview/Http/Index.html
- Project changed from 9 to TYPO3 Core
- TYPO3 Version set to 10
With activated Guzzle-Middleware the Variable $GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler'] has one empty value only:
The debug-output is done here: TYPO3\CMS\Core\Http\Client\GuzzleClientFactory::getClient:38 before the hook.
Without Guzzle-Middleware the handler-stack has 4 handlers:
I remarked that my usage in the provided extension is not complete and the method handle has to return a callable.
The examples on https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Http/Index.html are working as simple hook but never fulfill the requirements for a guzzle-middleware. Therefore the hook fails in a stack of working middlewares.
Further info: https://docs.guzzlephp.org/en/latest/handlers-and-middleware.html#handlers
While the linked TYPO3-documentation can be regarded as completely misleading and wrong the requirement fore a simple hook does exist and is quite useful.
My combination of the examples of the linked TYPO3-documentation is wrong, nevertheless the requirement for a simple hook does exist and is quite useful, btw. it's used in production already and I've another production candidate for the hook.
As painful as it is for me: the issue can be closed.
- Status changed from Needs Feedback to Closed
Thanks for the feedback and sharing all the details. I'm sure people will get back to this issue and find this information from you helpful.
- Related to Bug #94015: GeneralUtility::xml2array() can't be used in Guzzle middleware added
Also available in: Atom
PDF