Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: «adminhtml/system.xml» file indented with TAB character breaks Magento XML parser #1520

Closed
dmitrii-fediuk opened this issue Jul 20, 2015 · 5 comments

Comments

@dmitrii-fediuk
Copy link

An example of «adminhtml/system.xml» file is below.

<?xml version='1.0'?>
<config
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xsi:noNamespaceSchemaLocation='../../../../Magento/Config/etc/system_file.xsd'
>
    <system>
     <section id="checkout" translate="label" type="text" sortOrder="305" showInDefault="1" showInWebsite="1" showInStore="1">
         <label>Checkout</label>
         <tab>sales</tab>
         <resource>Magento_Checkout::checkout</resource>
         <group id="options" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
             <label>Checkout Options</label>
             <field id="onepage_checkout_enabled" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
                 <label>Enable Onepage Checkout</label>
                 <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
             </field>
         </group>
     </section>
 </system>
</config>

If the contents of config/system/section indented with tab character (instead of spaces) it breaks Magento XML parser with the trace below.
If change indents to spaces the parser works.

Warning: Invalid argument supplied for foreach() in app\code\Magento\Config\Model\Config\Structure\Mapper\Sorting.php on line 34
#0 app\code\Magento\Config\Model\Config\Structure\Mapper\Sorting.php(34): Magento\Framework\App\ErrorHandler->handler(2, 'Invalid argumen...', 'C:\\work\\mage2.p...', 34, Array)
#1 app\code\Magento\Config\Model\Config\Structure\Mapper\Sorting.php(23): Magento\Config\Model\Config\Structure\Mapper\Sorting->_processConfig('\n\t ')
#2 app\code\Magento\Config\Model\Config\Structure\Converter.php(64): Magento\Config\Model\Config\Structure\Mapper\Sorting->map(Array)
#3 [internal function]: Magento\Config\Model\Config\Structure\Converter->convert(Object(DOMDocument))
#4 lib\internal\Magento\Framework\Interception\Interceptor.php(144): call_user_func_array(Array, Array)
#5 var\generation\Magento\Config\Model\Config\Structure\Converter\Interceptor.php(26): Magento\Config\Model\Config\Structure\Converter\Interceptor->___callPlugins('convert', Array, Array)
#6 app\code\Magento\Config\Model\Config\Structure\Reader.php(115): Magento\Config\Model\Config\Structure\Converter\Interceptor->convert(Object(DOMDocument))
#7 lib\internal\Magento\Framework\Config\Reader\Filesystem.php(119): Magento\Config\Model\Config\Structure\Reader->_readFiles(Object(Magento\Framework\Config\FileIterator))
#8 lib\internal\Magento\Framework\Config\Data\Scoped.php(103): Magento\Framework\Config\Reader\Filesystem->read('adminhtml')
#9 lib\internal\Magento\Framework\Config\Data\Scoped.php(81): Magento\Framework\Config\Data\Scoped->_loadScopedData()
#10 app\code\Magento\Config\Model\Config\Structure.php(66): Magento\Framework\Config\Data\Scoped->get()
#11 var\generation\Magento\Config\Model\Config\Structure\Interceptor.php(14): Magento\Config\Model\Config\Structure->__construct(Object(Magento\Config\Model\Config\Structure\Data), Object(Magento\Config\Model\Config\Structure\Element\Iterator\Tab), Object(Magento\Config\Model\Config\Structure\Element\FlyweightFactory), Object(Magento\Config\Model\Config\ScopeDefiner))
#12 lib\internal\Magento\Framework\ObjectManager\Factory\AbstractFactory.php(103): Magento\Config\Model\Config\Structure\Interceptor->__construct(Object(Magento\Config\Model\Config\Structure\Data), Object(Magento\Config\Model\Config\Structure\Element\Iterator\Tab), Object(Magento\Config\Model\Config\Structure\Element\FlyweightFactory), Object(Magento\Config\Model\Config\ScopeDefiner))
#13 lib\internal\Magento\Framework\ObjectManager\Factory\Dynamic\Developer.php(91): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Config\\...', Array)
#14 lib\internal\Magento\Framework\ObjectManager\ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Config\\...')
#15 lib\internal\Magento\Framework\ObjectManager\Factory\AbstractFactory.php(236): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Config\\...')
#16 lib\internal\Magento\Framework\ObjectManager\Factory\Dynamic\Developer.php(53): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Config\\...', NULL, 'configStructure', 'Magento\\Config\\...')
#17 lib\internal\Magento\Framework\ObjectManager\Factory\Dynamic\Developer.php(84): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Config\\...', Array, Array)
#18 lib\internal\Magento\Framework\ObjectManager\ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Config\\...', Array)
#19 lib\internal\Magento\Framework\App\ActionFactory.php(40): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Config\\...', Array)
#20 lib\internal\Magento\Framework\App\Router\Base.php(301): Magento\Framework\App\ActionFactory->create('Magento\\Config\\...', Array)
#21 lib\internal\Magento\Framework\App\Router\Base.php(161): Magento\Framework\App\Router\Base->matchAction(Object(Magento\Framework\App\Request\Http), Array)
#22 lib\internal\Magento\Framework\App\FrontController.php(41): Magento\Framework\App\Router\Base->match(Object(Magento\Framework\App\Request\Http))
#23 [internal function]: Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#24 lib\internal\Magento\Framework\Interception\Interceptor.php(74): call_user_func_array(Array, Array)
#25 lib\internal\Magento\Framework\Interception\Chain\Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#26 lib\internal\Magento\Framework\Interception\Interceptor.php(136): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#27 lib\internal\Magento\Framework\Module\Plugin\DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#28 [internal function]: Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#29 lib\internal\Magento\Framework\Interception\Interceptor.php(141): call_user_func_array(Array, Array)
#30 var\generation\Magento\Framework\App\FrontController\Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#31 lib\internal\Magento\Framework\App\Http.php(115): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#32 lib\internal\Magento\Framework\App\Bootstrap.php(257): Magento\Framework\App\Http->launch()
#33 index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#34 {main}
@dmitrii-fediuk dmitrii-fediuk changed the title «adminhtml/system.xml» file idented with TAB character breaks Magento XML parser «adminhtml/system.xml» file indented with TAB character breaks Magento XML parser Jul 20, 2015
@piotrekkaminski
Copy link
Contributor

internal ticket MAGETWO-40683

@dsikkema-magento
Copy link
Contributor

@dfediuk I'm unable to reproduce this so far. Can you provide the detailed steps you went through to get that stack trace?

I went into app/code/Magento/Checkout/etc/adminhtml/system.xml, placed tab characters everywhere, and was able to access and modify store configuration.

@dsikkema-magento
Copy link
Contributor

@dfediuk can you try with the latest code? It might have already been fixed by now.

@dsikkema-magento
Copy link
Contributor

I'm going to close this ticket, but please feel free to open another one and tag me if you are still experiencing this issue.

@dmitrii-fediuk dmitrii-fediuk changed the title «adminhtml/system.xml» file indented with TAB character breaks Magento XML parser BUG: «adminhtml/system.xml» file indented with TAB character breaks Magento XML parser Nov 27, 2015
@dmitrii-fediuk
Copy link
Author

I have found the bug source and fix it: https://mage2.pro/t/topic/36/2
@dsikkema please fix it in the core.

magento-team pushed a commit that referenced this issue Sep 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants