magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

IE11 in compatibility mode shows exception in backend list views #9544

Closed gerryka closed 7 years ago

gerryka commented 7 years ago

Preconditions

  1. A fresh Magento 2.1.6 CE without sample data is installed
  2. Set Magento to developer mode via "magento deploy:mode:set developer" to enable error output
  3. Make sure mod_headers Apache module is enabled so IE11 will receive X-UA-Compatible IE=edge header via default .htaccess provided with Magento 2.1.6 CE
  4. Setup your IE 11 browser to display the Magento store website in compatibility mode via cogwheel on the top right, settings for compatibility mode, add Magento website to compatibility mode
  5. IE11 for my testing was version 11.0.9600.18524 on Windows 7
  6. Enter one customer, one product and one order for testing purposes

Steps to reproduce

  1. Login to backend as admin
  2. Navigate to "Sales" > "Orders"

Expected result

  1. Magento shows a list of orders

Actual result

  1. Magento displays the following exception:
1 exception(s):
Exception #0 (Exception): Warning: DOMDocument::loadXML(): Empty string supplied as input in /var/www/vendor/magento/framework/View/Element/UiComponent/Config/DomMerger.php on line 324

Exception #0 (Exception): Warning: DOMDocument::loadXML(): Empty string supplied as input in /var/www/vendor/magento/framework/View/Element/UiComponent/Config/DomMerger.php on line 324
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'DOMDocument::lo...', '/var/www/vendor...', 324, Array)
#1 /var/www/vendor/magento/framework/View/Element/UiComponent/Config/DomMerger.php(324): DOMDocument->loadXML('')
#2 /var/www/vendor/magento/framework/View/Element/UiComponent/Config/DomMerger.php(393): Magento\Framework\View\Element\UiComponent\Config\DomMerger->createDomDocument('')
#3 /var/www/vendor/magento/framework/View/Element/UiComponent/Config/Reader.php(60): Magento\Framework\View\Element\UiComponent\Config\DomMerger->merge('')
#4 /var/www/vendor/magento/framework/View/Element/UiComponent/Config/Reader.php(47): Magento\Framework\View\Element\UiComponent\Config\Reader->readFiles(Array)
#5 /var/www/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(93): Magento\Framework\View\Element\UiComponent\Config\Reader->__construct(Object(Magento\Framework\View\Element\UiComponent\Config\FileCollector\AggregatedFileCollector), Object(Magento\Framework\View\Element\UiComponent\Config\Converter), Object(Magento\Framework\View\Element\UiComponent\Config\DomMerger))
#6 /var/www/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(89): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#7 /var/www/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...', Array)
#8 /var/www/vendor/magento/framework/View/Element/UiComponent/Config/ReaderFactory.php(40): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Framewo...', Array)
#9 /var/www/vendor/magento/framework/View/Element/UiComponent/Config/Provider/Template.php(106): Magento\Framework\View\Element\UiComponent\Config\ReaderFactory->create(Array)
#10 /var/www/vendor/magento/framework/View/TemplateEngine/Xhtml.php(78): Magento\Framework\View\Element\UiComponent\Config\Provider\Template->getTemplate(false)
#11 /var/www/vendor/magento/framework/View/Element/UiComponent/ContentType/Xml.php(66): Magento\Framework\View\TemplateEngine\Xhtml->render(Object(Magento\Ui\Component\Listing), false)
#12 /var/www/vendor/magento/module-ui/Component/AbstractComponent.php(155): Magento\Framework\View\Element\UiComponent\ContentType\Xml->render(Object(Magento\Ui\Component\Listing), 'templates/listi...')
#13 /var/www/vendor/magento/module-ui/Component/Wrapper/UiComponent.php(72): Magento\Ui\Component\AbstractComponent->render()
#14 /var/www/vendor/magento/framework/View/Element/AbstractBlock.php(659): Magento\Ui\Component\Wrapper\UiComponent->_toHtml()
#15 /var/www/vendor/magento/framework/View/Layout.php(555): Magento\Framework\View\Element\AbstractBlock->toHtml()
#16 /var/www/vendor/magento/framework/View/Layout.php(516): Magento\Framework\View\Layout->_renderUiComponent('sales_order_gri...')
#17 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('sales_order_gri...')
#18 /var/www/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('sales_order_gri...')
#19 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('sales_order_gri...', true)
#20 /var/www/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('sales_order_gri...')
#21 /var/www/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('content')
#22 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('content')
#23 /var/www/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('content')
#24 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('content', true)
#25 /var/www/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('content')
#26 /var/www/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('main.col')
#27 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('main.col')
#28 /var/www/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main.col')
#29 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('main.col', true)
#30 /var/www/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('main.col')
#31 /var/www/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('admin.scope.col...')
#32 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('admin.scope.col...')
#33 /var/www/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('admin.scope.col...')
#34 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('admin.scope.col...', true)
#35 /var/www/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('admin.scope.col...')
#36 /var/www/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('page.main.conta...')
#37 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.main.conta...')
#38 /var/www/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.main.conta...')
#39 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.main.conta...', true)
#40 /var/www/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('page.main.conta...')
#41 /var/www/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('page.content')
#42 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.content')
#43 /var/www/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.content')
#44 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.content', true)
#45 /var/www/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('page.content')
#46 /var/www/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('page.wrapper')
#47 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper')
#48 /var/www/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper')
#49 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.wrapper', true)
#50 /var/www/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper')
#51 /var/www/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('backend.page')
#52 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('backend.page')
#53 /var/www/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('backend.page')
#54 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('backend.page', true)
#55 /var/www/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('backend.page')
#56 /var/www/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('root')
#57 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('root')
#58 /var/www/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root')
#59 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('root', true)
#60 /var/www/vendor/magento/framework/View/Layout.php(938): Magento\Framework\View\Layout\Interceptor->renderElement('root')
#61 /var/www/var/generation/Magento/Framework/View/Layout/Interceptor.php(492): Magento\Framework\View\Layout->getOutput()
#62 /var/www/vendor/magento/framework/View/Result/Page.php(243): Magento\Framework\View\Layout\Interceptor->getOutput()
#63 /var/www/vendor/magento/framework/View/Result/Layout.php(164): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#64 /var/www/var/generation/Magento/Backend/Model/View/Result/Page/Interceptor.php(193): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#65 /var/www/vendor/magento/framework/App/Http.php(139): Magento\Backend\Model\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#66 /var/www/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#67 /var/www/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#68 {main}
korostii commented 7 years ago

Are you sure that IE is necessary to reproduce the issue? Since the error in question is server-side, that seems unlikely.

In my experience, there's also a high probability that the error's root cause is a custom or 3rd-party module which attempts to modify the looks of the Orders' grid. In order to confirm that, please check your Magento's logs for errors first (Read here on how to find those), there might be an extra error caused by Invalid XML. (Alternatively, you could attempt to reproduce the issue on a clean installation of Magento CE and test whether the error persists)

gerryka commented 7 years ago

This is on a clean installation of Magento CE without any 3rd party modules or custom modules. I was not able to reproduce the issue on any other browser except this specific configuration of IE11 with compatibility mode turned on.

And yes it also seems very unlikely to me that a browser setting would cause an error in PHP server-side code. But so far it is what I am seeing here. I will debug further and see what I can come up with.

gerryka commented 7 years ago

Sadly i did not come up with any further info from my (limited) debugging session. I would appreciate it if anyone could take a look at this. Should be pretty easy to reproduce with the above instructions.

Rane2k commented 7 years ago

This seems to stem from the HTTP Accept header.

Some testing shows the following:

Chrome (60.0.3112.113) sends Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8

IE 11 with activated compatiblity mode sends: Accept:image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/xaml+xml, application/x-ms-xbap, */*

Note that both strings contain "*/*", allowing any MIME type.

The problem then begins in \Magento\Framework\View\Element\UiComponent\Context::setAcceptType

Because the IE´s Accept header contains the string 'xml', XML is then chosen.

We then continue in \Magento\Framework\View\Element\UiComponent\Context::getRenderEngine, which uses the chosen accept type to select the render engine: Magento\Framework\View\Element\UiComponent\ContentType\Xml

This seems to be the heart of the issue. I am hesitant to create a pull request for a fix, because I have no idea if changing the setAcceptType function has adverse effects on other areas of Magento, but maybe the Magento team can use this.

Edit: The comment system has swallowed part of the accept string. correcting.

magento-engcom-team commented 7 years ago

@gerryka, thank you for your report. We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue. We tested the issue on 2.3.0-dev, 2.2.0, 2.1.9