Update Merge.php #265

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@mrploddy

Hi there,

There is an issue with Module layout xml files being blank and the _loadFileLayoutUpdatesXML() function erroring out on line 642.

How to reproduce -
Create a new magento 2 module but create a new front end or admin layout xml file but make the file blank with nothing inside it. Try to load the front end and it will produce the message.

This could be an issue when uploads of modules fails eg partial FTP uploads and so on.

Fatal error: Call to a member function innerXml() on a non-object in /home/mage2craig/public_html/app/code/core/Mage/Core/Model/Layout/Merge.php on line 643

Proposed Fix -
Check for the existence of the object before actually trying to include it eg as per the following code snippet - lines 641 to 642

$fileXml = simplexml_load_string($fileStr, $this->_elementClass);
if ($fileXml) {
$layoutStr .= $fileXml->innerXml();
}

Regards

mrploddy

@@ -639,7 +639,9 @@ protected function _loadFileLayoutUpdatesXml()
$fileStr = str_replace($this->_subst['from'], $this->_subst['to'], $fileStr);
/** @var $fileXml Mage_Core_Model_Layout_Element */
$fileXml = simplexml_load_string($fileStr, $this->_elementClass);
- $layoutStr .= $fileXml->innerXml();
+ if ($fileXml){

This comment has been minimized.

@mrploddy

mrploddy Mar 22, 2013

Check that the $fileXml actually exists and isn't a null object.

@mrploddy

mrploddy Mar 22, 2013

Check that the $fileXml actually exists and isn't a null object.

@verklov

This comment has been minimized.

Show comment
Hide comment
@verklov

verklov Nov 7, 2013

Contributor

Hello mrploddy,
Sorry for the delay with response.
Thank you for your contribution! Our team will review your pull request and respond as soon as our analysis is complete.

Contributor

verklov commented Nov 7, 2013

Hello mrploddy,
Sorry for the delay with response.
Thank you for your contribution! Our team will review your pull request and respond as soon as our analysis is complete.

magento-team added a commit that referenced this pull request Nov 29, 2013

2.0.0.0-dev54
* Modularity improvements:
  * Breakdown of the Adminhtml module:
     * Moved Newsletter, Report logic to the respective modules
     * Moved blocks, config, view, layout files of other components from Adminhtml folder to respective modules
  * Removed application dependencies from the library
* Move Magento\Core common blocks in the library
* Application areas rework:
  * Areas are independent from Store
  * Removed deprecated annotation from the getArea methods
* GitHub requests:
  * [#245](#245) -- Resolve design flaws in core URL helper
  * [#247](#247) -- Bug in Mage_Page_Block_Html_Header->getIsHomePage
  * [#259](#259) -- Turkish Lira (TRY) is supported for Turkish members.
  * [#262](#262) -- Update Rule.php
  * [#373](#373) -- [Magento/Sales] Fixed typos
  * [#382](#382) -- [Magento/Core] Fixed typos
  * [#304](#304) -- Removed Erroneous closing "
  * [#323](#323) -- InstanceController.php - made setBody protected
  * [#349](#349) -- Move Mage_Catalog menu declaration into Mage_Catalog module.
  * [#265](#265) -- Update Merge.php
  * [#271](#271) -- Check Data should validate gallery information
  * [#305](#305) -- Extra ", tidied up nested quotes
  * [#352](#352) -- Add Croatia Country as part of European Union since 1st July 2013 for default european local countries in configuration
  * [#224](#224) -- Tax formatting is locale aware and should not
  * [#338](#338) -- Correcting SQL for required_options column
  * [#327](#327) -- cart api bug fix & partial invoice credit memo divide by zero warning
* Themes update:
  * Old frontend (magento_demo) and backend (magento_basic) themes are removed
  * Updated templates and layout updates in the Bundle, Catalog, CatalogInventory, CatalogSearch, Downloadable, ProductAlert, Reports, Sendfriend modules
* Fixed bugs:
  * Fixed the error when  Magento cannot be reinstalled to the same database with table prefix
  * Fixed report Products in Cart
  * Fixed error on attempt to insert image to CMS pages under version control
  * Fixed order status grid so that you can assign state, edit, and view custom order status
  * Fixed Related Products Rule page so that category can be selected on conditions tab
  * Fixed Magento_Paypal_Controller_ExpressTest integration test so it is re-enabled
  * Fixed the bug with international DHL quotes
@verklov

This comment has been minimized.

Show comment
Hide comment
@verklov

verklov Nov 29, 2013

Contributor

Hello mrploddy,
We have processed your pull request. The code is released in version dev54.

Contributor

verklov commented Nov 29, 2013

Hello mrploddy,
We have processed your pull request. The code is released in version dev54.

@verklov verklov closed this Nov 29, 2013

vpelipenko added a commit that referenced this pull request May 8, 2015

Merge pull request #265 from magento-firedrakes/MAGETWO-33528
[Firedrakes] MAGETWO-33528: M2 GitHub Update (version 0.74.0-beta7)

magento-team pushed a commit that referenced this pull request Dec 23, 2015

Merge pull request #265 from magento-ogre/PR_Branch
[Ogres] Bug fixes and custom vendor part 1

omiroshnichenko pushed a commit to omiroshnichenko/magento2 that referenced this pull request Feb 15, 2018

Merge pull request #265 from magento-engcom/fix-source-item-import
Fix broken Source Item Import. Column names aligned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment