Bug #91625

UriBuilder: inconsistent behaviour between application contexts Development + Production

Added by Michael Stopp about 2 years ago. Updated 10 months ago.

Should have
Target version:
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


I have a class method that gets called by a hook of felogin.

In this method I use the uriFor() method of UriBuilder to build a redirect URL. This works without a problem in my development environment, which runs in application context Development.

After installing the extension in the live environment (running in application context Production), I ran into constant problems. Building the redirect URL works maybe once in ten attempts. For the rest of the time it fails with "Call to a member function typoLink_URL() on null", which seems to be caused by $this->contentObject not being set in buildFrontendUri(). I haven't found out yet, why it works sometimes. I tried clearing caches and reloading and what not. I then switched the live environment to application context Development and everything works again without a problem.

This raises several questions:

1) What's going on? Why does it occasionally work? I know there can be issues when UriBuilder is called in special situations (eg. scheduler tasks, command controllers), but here we are in FE mode, so what's the problem? (According to the API docs this "Works in Frontend and Backend mode of TYPO3".)

2) Why can code, which was written in application context Development, not safely be used in Production? That seems to defy the whole point of application contexts. Why should I even bother to develop in application context Development, if I can't be sure that it will later work in the live environment?

Related issues

Related to TYPO3 Core - Bug #95118: Unable to use UriBuilder outside ExtbaseClosed2021-09-06

Related to TYPO3 Core - Bug #95265: Revert injection of ContentObjectRenderer in UriBuilderRejectedBenni Mack2021-09-17


Also available in: Atom PDF