contao / standard-edition

[DEPRECATED] Do not use anymore!
33 stars 8 forks source link

Attempted to load class \"Config\" from the global namespace. #64

Closed bennyborn closed 7 years ago

bennyborn commented 7 years ago

Just tried to update to Contao 4.4, even tried a fresh installation of the standard-edition. In both cases I end up with the following exception:

app.CRITICAL: An exception occurred. {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ClassNotFoundException(code: 0): Attempted to load class \"Config\" from the global namespace.\nDid you forget a \"use\" statement? at E:\\Programme\\UwAmp\\www\\ubm\\vendor\\contao\\core-bundle\\src\\Resources\\contao\\library\\Contao\\Environment.php:537)"} []

Some users in the forums have the same problem while the managed-edition seems to run fine.

aschempp commented 7 years ago

If you use the standard edition, you have to update your application configuration after updates. Make sure your app files and web entry points are in sync with the standard edition.

bennyborn commented 7 years ago

They are. As I already mentioned this also happens in a completely fresh installation of the standard-edition

composer create-project contao/standard-edition something
michb commented 7 years ago

I've now setup several Contao 4.4.0 projects using Composer and got similar errors that seem to fit this issue. Sometimes I recieve the same error as mentioned above or the same problem with the \Validator class.

Yesterday I aditionally installed Isotope. Everything worked fine. And Today after starting my development enviroment I got this error

Symfony\Component\Debug\Exception\ClassNotFoundException
Attempted to load class "Payment" from namespace "Isotope\Model". Did you forget a "use" statement for another namespace?
aschempp commented 7 years ago

Looks like the Contao framework is not correctly bootet, the Contao class loader does not work. I don't have an explanation out of my head why this would happen in the standard-edition but not managed-edition. I assume you correctly registered all bundles in the kernel…?

michb commented 7 years ago

While I encounted this problem I also set-up a managed edition, to see what happens. There I got the same errors.

AppKernel was edited to load additional modules in the right order.

aschempp commented 7 years ago

Interesting. Can you post a composer show result?

michb commented 7 years ago

sure, I compared this installation with a working one and see no difference, despite the fact that Isotope is installed.

clue/stream-filter                        v1.3.0    A simple and modern approach to stream filtering in PHP
codefog/contao-haste                      4.17.2    haste extension for Contao Open Source CMS
composer/ca-bundle                        1.0.7     Lets you find a path to the system CA bundle, and includes a f...
contao-community-alliance/composer-plugin 3.0.5     Composer plugin that provides installers for contao-module and...
contao-components/ace                     1.2.6     ACE code editor integration for Contao Open Source CMS
contao-components/chosen                  1.1.7     Chosen integration for Contao Open Source CMS
contao-components/colorbox                1.6.4     Colorbox integration for Contao Open Source CMS
contao-components/colorpicker             1.4.0.1   Color picker integration for Contao Open Source CMS
contao-components/compass                 0.12.2.1  Compass integration for Contao Open Source CMS
contao-components/contao                  7.1.1     Contao Open Source CMS components
contao-components/datepicker              2.2.0.3   Date picker integration for Contao Open Source CMS
contao-components/dropzone                4.3.0     DropZone integration for Contao Open Source CMS
contao-components/highlight               8.9.1     Highlight.js integration for Contao Open Source CMS
contao-components/html5shiv               3.7.3     HTML5 Shiv integration for Contao Open Source CMS
contao-components/installer               1.2.5     Contao components installer
contao-components/jquery                  1.12.4    jQuery integration for Contao Open Source CMS
contao-components/jquery-ui               1.12.1    jQuery UI integration for Contao Open Source CMS
contao-components/mediabox                1.5.4.1   Mediabox integration for Contao Open Source CMS
contao-components/mediaelement            4.1.3     MediaElement.js integration for Contao Open Source CMS
contao-components/mootools                1.6.0.4   MooTools integration for Contao Open Source CMS
contao-components/respimage               1.4.2     Respimage.js integration for Contao Open Source CMS
contao-components/simplemodal             2.0.4     SimpleModal integration for Contao Open Source CMS
contao-components/swipe                   2.0.6.1   A JavaScript touch slider with dot menu
contao-components/tablesort               3.4.8     Contao Open Source CMS tablesort
contao-components/tablesorter             2.0.5.5   jQuery tablesorter integration for Contao Open Source CMS
contao-components/tinymce4                4.6.2.1   TinyMCE 4 integration for Contao Open Source CMS
contao/calendar-bundle                    4.4.0     Adds calendar functionality to Contao 4
contao/comments-bundle                    4.4.0     Adds comments functionality to Contao 4
contao/core-bundle                        4.4.0     Contao 4 core bundle
contao/faq-bundle                         4.4.0     Adds FAQ functionality to Contao 4
contao/image                              0.3.4     Contao image library
contao/imagine-svg                        0.1.4     Contao Imagine SVG library
contao/installation-bundle                4.4.0     Required to install and update Contao 4
contao/listing-bundle                     4.4.0     Allows to list arbitrary data in the Contao 4 front end
contao/manager-bundle                     4.4.0     Contao 4 manager bundle
contao/manager-plugin                     2.1.0     Contao 4 manager plugin
contao/news-bundle                        4.4.0     Adds news functionality to Contao 4
contao/newsletter-bundle                  4.4.0     Adds newsletter functionality to Contao 4
doctrine/annotations                      v1.4.0    Docblock Annotations Parser
doctrine/cache                            v1.6.1    Caching library offering an object-oriented API for many cache...
doctrine/collections                      v1.4.0    Collections Abstraction library
doctrine/common                           v2.7.2    Common Library for Doctrine projects
doctrine/dbal                             v2.5.12   Database Abstraction Layer
doctrine/doctrine-bundle                  1.6.8     Symfony DoctrineBundle
doctrine/doctrine-cache-bundle            1.3.0     Symfony Bundle for Doctrine Cache
doctrine/inflector                        v1.1.0    Common String Manipulations with regard to casing and singular...
doctrine/lexer                            v1.0.1    Base library for a lexer that can be used in Top-Down, Recursi...
fig/link-util                             1.0.0     Common utility implementations for HTTP links
friendsofsymfony/http-cache               2.0.0     Tools to manage HTTP caching proxies with PHP
friendsofsymfony/http-cache-bundle        2.0.0     Set path based HTTP cache headers and send invalidation reques...
guzzlehttp/guzzle                         6.2.3     Guzzle is a PHP HTTP client library
guzzlehttp/promises                       v1.3.1    Guzzle promises library
guzzlehttp/psr7                           1.4.2     PSR-7 message implementation that also provides common utility...
imagine/imagine                           v0.6.3    Image processing for PHP 5.3
isotope/isotope-core                      2.4.1     Core repository of Isotope eCommerce, an eCommerce extension f...
jdorn/sql-formatter                       v1.2.17   a PHP SQL highlighting library
jeremykendall/php-domain-parser           3.0.0     Public Suffix List based URL parsing implemented in PHP.
knplabs/knp-menu                          2.2.0     An object oriented menu library
knplabs/knp-menu-bundle                   2.1.3     This bundle provides an integration of the KnpMenu library
knplabs/knp-time-bundle                   1.7.3     Knplabs time bundle makes your dates look sensible and descrip...
leafo/scssphp                             v0.6.7    scssphp is a compiler for SCSS written in PHP.
league/uri                                4.2.2     URI manipulation library
lexik/maintenance-bundle                  v2.1.1    This bundle allows you to place your website in maintenance mo...
matthiasmullie/minify                     1.3.45    CSS & JS minifier
matthiasmullie/path-converter             1.1.0     Relative path converter
menatwork/contao-multicolumnwizard        3.3.10    MultiColumWizard for Contao OpenSource CMS
michelf/php-markdown                      1.7.0     PHP Markdown
monolog/monolog                           1.22.1    Sends your logs to files, sockets, inboxes, databases and vari...
nelmio/cors-bundle                        1.5.3     Adds CORS (Cross-Origin Resource Sharing) headers support in y...
nelmio/security-bundle                    2.3.1     Extra security-related features for Symfony: signed/encrypted ...
oyejorge/less.php                         v1.7.0.14 PHP port of the Javascript version of LESS http://lesscss.org ...
paragonie/random_compat                   v2.0.10   PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
patchwork/utf8                            v1.3.1    Portable and performant UTF-8, Unicode and Grapheme Clusters f...
php-http/client-common                    1.5.0     Common HTTP Client implementations and tools for HTTPlug
php-http/discovery                        1.2.1     Finds installed HTTPlug implementations and PSR-7 message fact...
php-http/guzzle6-adapter                  v1.1.1    Guzzle 6 HTTP Adapter
php-http/httplug                          v1.1.0    HTTPlug, the HTTP client abstraction for PHP
php-http/message                          1.5.0     HTTP Message related tools
php-http/message-factory                  v1.0.2    Factory interfaces for PSR-7 HTTP Message
php-http/promise                          v1.0.0    Promise used for asynchronous HTTP requests
phpspec/php-diff                          v1.1.0    A comprehensive library for generating differences between two...
phpunit/php-token-stream                  1.4.11    Wrapper around PHP's tokenizer extension.
psr/cache                                 1.0.1     Common interface for caching libraries
psr/container                             1.0.0     Common Container Interface (PHP FIG PSR-11)
psr/http-message                          1.0.1     Common interface for HTTP messages
psr/link                                  1.0.0     Common interfaces for HTTP links
psr/log                                   1.0.2     Common interface for logging libraries
psr/simple-cache                          1.0.0     Common interfaces for simple caching
sensio/distribution-bundle                v5.0.20   Base bundle for Symfony Distributions
sensio/framework-extra-bundle             v3.0.26   This bundle provides a way to configure your controllers with ...
sensiolabs/ansi-to-html                   v1.1.3    A library to convert a text with ANSI codes to HTML
sensiolabs/security-checker               v4.0.4    A security checker for your composer.lock
simplepie/simplepie                       1.5       A simple Atom/RSS parsing library for PHP
swiftmailer/swiftmailer                   v5.4.8    Swiftmailer, free feature-rich PHP mailer
symfony/monolog-bundle                    v2.12.1   Symfony MonologBundle
symfony/polyfill-intl-icu                 v1.4.0    Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring                 v1.4.0    Symfony polyfill for the Mbstring extension
symfony/polyfill-php56                    v1.4.0    Symfony polyfill backporting some PHP 5.6+ features to lower P...
symfony/polyfill-php70                    v1.4.0    Symfony polyfill backporting some PHP 7.0+ features to lower P...
symfony/polyfill-util                     v1.4.0    Symfony utilities for portability of PHP codes
symfony/swiftmailer-bundle                v2.6.2    Symfony SwiftmailerBundle
symfony/symfony                           v3.3.2    The Symfony PHP framework
tecnickcom/tcpdf                          6.2.12    TCPDF is a PHP class for generating PDF documents and barcodes.
terminal42/contao-conditionalselectmenu   3.0.3     conditional select menu extension for Contao Open Source CMS
terminal42/contao-tablelookupwizard       3.2.1     Contao widget to select records from a foreign table. Useful i...
terminal42/dc_multilingual                2.1.7     DC_Multilingual extension for Contao Open Source CMS
terminal42/dcawizard                      2.3.4     dcaWizard extension for Contao Open Source CMS
terminal42/header-replay-bundle           1.0.0     Send preflight requests for user context headers and replay th...
terminal42/notification_center            1.4.1     Notification Center extension for Contao Open Source CMS
true/punycode                             v2.1.1    A Bootstring encoding of Unicode for Internationalized Domain ...
twig/twig                                 v1.34.3   Twig, the flexible, fast, and secure template language for PHP
ua-parser/uap-php                         v3.4.7    A multi-language port of Browserscope's user agent parser.
webmozart/assert                          1.2.0     Assertions to validate method input/output with nice error mes...
webmozart/path-util                       2.3.0     A robust cross-platform utility for normalizing, comparing and...
aschempp commented 7 years ago

You're not using Authoritative class maps right?

michb commented 7 years ago

Right, i'm not using this.

bennyborn commented 7 years ago

Interestingly I am able to reproduce this problem (Attempted to load class "Config") permanently by installing any extension which has a .htaccess file (mostly located in the assets folder of the extension).

In my case it doesn't even matter where exactly this file is located as long as it's in system/modules.

Does any Autoloader try to scan this folder and gets somehow confused by the .htaccess?

bennyborn commented 7 years ago

Upon further inspection this problem seems to be related to the installation-bundle rather than the standard-edition.

Trying to get Isotope running yields fatal errors where some classes are not found and this error printing is a pure PHP error, not a Symfony one.


( ! ) Fatal error: Class 'Model' not found in D:\Programme\UwAmp\www\NOTIMPORTANT\vendor\isotope\isotope-core\system\modules\isotope\library\Isotope\Model\Config.php on line 68
Call Stack
#   Time    Memory  Function    Location
1   2.0020  11230688    Symfony\Component\Debug\ErrorHandler->handleException( )    ...\ErrorHandler.php:0
2   2.0067  11316920    Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->handleError( )    ...\ErrorHandler.php:557
3   2.0068  11317344    Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->getClassCandidates( ) ...\ClassNotFoundFatalErrorHandler.php:62
4   2.3267  11337064    Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->findClassInPath( )    ...\ClassNotFoundFatalErrorHandler.php:111
5   2.4741  11340448    Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->convertFileToClass( ) ...\ClassNotFoundFatalErrorHandler.php:143
6   2.4759  11377040    require_once( 'D:\Programme\UwAmp\www\NOTIMPORTANT\vendor\isotope\isotope-core\system\modules\isotope\library\Isotope\Model\Config.php' )   ...\ClassNotFoundFatalErrorHandler.php:188

( ! ) Fatal error: Class 'Model' not found in D:\Programme\UwAmp\www\NOTIMPORTANT\vendor\codefog\contao-haste\library\Haste\Model\Model.php on line 15
Call Stack
#   Time    Memory  Function    Location
1   2.0020  11230688    Symfony\Component\Debug\ErrorHandler->handleException( )    ...\ErrorHandler.php:0
2   2.0067  11316920    Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->handleError( )    ...\ErrorHandler.php:557
3   2.0068  11317344    Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->getClassCandidates( ) ...\ClassNotFoundFatalErrorHandler.php:62
4   2.3267  11337064    Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->findClassInPath( )    ...\ClassNotFoundFatalErrorHandler.php:111
5   2.4741  11340448    Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->convertFileToClass( ) ...\ClassNotFoundFatalErrorHandler.php:143
6   2.4759  11377040    require_once( 'D:\Programme\UwAmp\www\NOTIMPORTANT\vendor\isotope\isotope-core\system\modules\isotope\library\Isotope\Model\Config.php' )   ...\ClassNotFoundFatalErrorHandler.php:188
7   2.4764  11377184    Symfony\Component\Debug\ErrorHandler::handleFatalError( )   ...\ErrorHandler.php:0
8   2.4765  11370736    Symfony\Component\Debug\ErrorHandler->handleException( )    ...\ErrorHandler.php:629
9   2.4765  11371080    Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->handleError( )    ...\ErrorHandler.php:557
10  2.4765  11371504    Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->getClassCandidates( ) ...\ClassNotFoundFatalErrorHandler.php:62
11  3.1546  11373376    Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->findClassInPath( )    ...\ClassNotFoundFatalErrorHandler.php:111
12  3.2045  11376360    Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->convertFileToClass( ) ...\ClassNotFoundFatalErrorHandler.php:143
13  3.2059  11425568    require_once( 'D:\Programme\UwAmp\www\NOTIMPORTANT\vendor\codefog\contao-haste\library\Haste\Model\Model.php' ) ...\ClassNotFoundFatalErrorHandler.php:188

In conclusion there seems to be some autoloading related problems in the installation-bundle.

dmolineus commented 7 years ago

Does this issue only occur on windows machines?

bennyborn commented 7 years ago

Yep, Windows only. Never encountered such problems on a Linux machine. Unfortunately Windows is our main development platform.

fritzmg commented 7 years ago

Here are two more cases:

I am developing on Windows as well - though I never encountered this issue so far.

fritzmg commented 7 years ago

Looks like the Contao framework is not correctly bootet, the Contao class loader does not work.

What's weird though is that only the Config class (or at least only specific classes) do not work. The error occurs within the Environment class of Contao - so obviously at least that one got loaded just fine.

ausi commented 7 years ago

@fritzmg If the Environment class was used with the Contao\ namespace it gets loaded via the Composer autoloader. So if \Contao\Environment::get('agent') gets called before the framework was booted, the Environment class gets loaded from the Contao namespace, but this error occurs because the Config class is missing from the global namespace.

fritzmg commented 7 years ago

I see. Looking at the https://github.com/contao/installation-bundle/blob/4.4.2/src/Controller/InstallationController.php#L63 this could happen if

$this->container->has('contao.framework')

returns false for some reason - and thus the Contao Framework is not initialized. Because once the InstallationController calls its render function, Environment::get('agent') will be accessed (through addDefaultsToContext).

However, under what circumstances does $this->container->has('contao.framework') return false? I tested it again with a completely fresh non-composer install (i.e. downloading the Contao 4.4.2 Managed Edition from contao.org) and then directly opening the Install Tool with example.org/contao/install. $this->container->has('contao.framework') will return true right away.

Same story with composer create-project contao/managed-edition.

dmolineus commented 7 years ago

Das Problem tritt dann auf, wenn InstallationController.php#L59-L61 einen Fehler wirft, Z.B. fehlerhafte Symlinkerstellung unter Windows.

Ist dies der Fall, ruft InstallationController.php#L127-L131 die Methode render() auf bevor das Contao-Framework initialisiert wurde. render() nutzt die Environment-Klasse InstallationController.php#L589, die die Config Klasse über den Alias \Config nutzt.

fritzmg commented 7 years ago

I was able to reproduce the problem under Linux as well. If the PHP process is unable to create symlinks, this error will occur.

 (1/1) ClassNotFoundException

Attempted to load class "Config" from the global namespace.
Did you forget a "use" statement?
in Environment.php (line 537)
at Environment::agent()in Environment.php (line 65)
at Environment::get('agent')in InstallationController.php (line 589)
at InstallationController->addDefaultsToContext(array('has_admin' => false, 'hide_admin' => false, 'output' => ' --- ------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------    Symlink   Target / Error  --- ------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ✘ web/files/content Failed to create symbolic link from "../../files/content" to "[…]/htdocs/web/files/content". ✘ web/files/vendor Failed to create symbolic link from "../../files/vendor" to "[…]/htdocs/web/files/vendor". ✘ web/files/deathtostock Failed to create symbolic link from "../../files/deathtostock" to "[…]/htdocs/web/files/deathtostock". ✘ web/files/themes/[…] Failed to create symbolic link from "../../../files/themes/[…]" to "[…]/htdocs/web/files/themes/[…]". ✘ web/system/modules/backend_documentation/assets Failed to create symbolic link from "../../../../system/modules/backend_documentation/assets" to "[…]/htdocs/web/system/modules/backend_documentation/assets". ✘ web/system/modules/widget_tree_picker/assets Failed to create symbolic link from "../../../../system/modules/widget_tree_picker/assets" to "[…]/htdocs/web/system/modules/widget_tree_picker/assets". ✘ web/system/modules/widget_tree_picker/public Failed to create symbolic link from "../../../../system/modules/widget_tree_picker/public" to "[…]/htdocs/web/system/modules/widget_tree_picker/public". ✘ web/system/modules/news_categories/assets Failed to create symbolic link from "../../../../system/modules/news_categories/assets" to "[…]/htdocs/web/system/modules/news_categories/assets". ✔ system/themes/flexible vendor/contao/core-bundle/src/Resources/contao/themes/flexible ✔ web/assets assets ✔ web/system/themes system/themes ✔ system/logs var/logs --- ------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ', 'request_token' => 'h8XKej5HiEOXQjehTqxSQAa2_gd9gC-a0reAippvW5M', 'language' => 'en'))in InstallationController.php (line 542)
at InstallationController->render('initialize.html.twig', array('output' => ' --- ------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------    Symlink   Target / Error  --- ------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ✘ web/files/content Failed to create symbolic link from "../../files/content" to "[…]/htdocs/web/files/content". ✘ web/files/vendor Failed to create symbolic link from "../../files/vendor" to "[…]/htdocs/web/files/vendor". ✘ web/files/deathtostock Failed to create symbolic link from "../../files/deathtostock" to "[…]/htdocs/web/files/deathtostock". ✘ web/files/themes/[…] Failed to create symbolic link from "../../../files/themes/[…]" to "[…]/htdocs/web/files/themes/[…]". ✘ web/system/modules/backend_documentation/assets Failed to create symbolic link from "../../../../system/modules/backend_documentation/assets" to "[…]/htdocs/web/system/modules/backend_documentation/assets". ✘ web/system/modules/widget_tree_picker/assets Failed to create symbolic link from "../../../../system/modules/widget_tree_picker/assets" to "[…]/htdocs/web/system/modules/widget_tree_picker/assets". ✘ web/system/modules/widget_tree_picker/public Failed to create symbolic link from "../../../../system/modules/widget_tree_picker/public" to "[…]/htdocs/web/system/modules/widget_tree_picker/public". ✘ web/system/modules/news_categories/assets Failed to create symbolic link from "../../../../system/modules/news_categories/assets" to "[…]/htdocs/web/system/modules/news_categories/assets". ✔ system/themes/flexible vendor/contao/core-bundle/src/Resources/contao/themes/flexible ✔ web/assets assets ✔ web/system/themes system/themes ✔ system/logs var/logs --- ------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- '))in InstallationController.php (line 129)
at InstallationController->initializeApplication()in InstallationController.php (line 59)
at InstallationController->installAction()
at call_user_func_array(array(object(InstallationController), 'installAction'), array())in HttpKernel.php (line 153)
at HttpKernel->handleRaw(object(Request), 1)in HttpKernel.php (line 68)
at HttpKernel->handle(object(Request), 1, true)in Kernel.php (line 171)
at Kernel->handle(object(Request))in app_dev.php (line 62)

I can confirm the conclusion of @dmolineus

fritzmg commented 7 years ago

Proposed fix:

    /**
     * Initializes the application.
     *
     * @return Response|null
     */
    private function initializeApplication()
    {
        $event = new InitializeApplicationEvent();

        $this->container->get('event_dispatcher')->dispatch(ContaoInstallationEvents::INITIALIZE_APPLICATION, $event);

        if ($event->hasOutput()) {
            return $this->render('initialize.html.twig', [
                'output' => $event->getOutput(),
+               'ua' => '',
            ]);
        }

        return null;
    }

Since the Contao Framework is definitely not initialized yet when initializeApplication is called, this would prevent the Environment class from being used. This will then show this screen (which otherwise currently does not work):

screen shot 2017-08-07 at 13 48 21

I'd like a more robust solution for this though.

ausi commented 7 years ago

Shouldn’t this be fixed in installation-bundle/src/Controller/InstallationController.php:589 by checking against $this->container->get('contao.framework')->isInitialized() ?

fritzmg commented 7 years ago

Yes, but you would also need a $this->container->has('contao.framework'), right?

ausi commented 7 years ago

Yes:

if (
    $this->container->has('contao.framework')
    && $this->container->get('contao.framework')->isInitialized()
) {
    $context['ua'] = Environment::get('agent')->class;
}
fritzmg commented 7 years ago

So in total it would be

if (!isset($context['ua']) &&
    $this->container->has('contao.framework') && 
    $this->container->get('contao.framework')->isInitialized()) {
    $context['ua'] = Environment::get('agent')->class;
}
leofeyer commented 7 years ago

Fixed in contao/installation-bundle@f04da58fe3607a890dd193cbaa8e188be3080f00.