Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update Merge.php #265

Closed
wants to merge 1 commit into from

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

@mrploddy mrploddy commented on the diff
app/code/core/Mage/Core/Model/Layout/Merge.php
@@ -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){

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@verklov

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.

@mage2-team mage2-team referenced this pull request from a commit
@mage2-team mage2-team 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
6e24c0b
@verklov

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

@verklov verklov closed this
@SchumacherFM SchumacherFM referenced this pull request from a commit
@SchumacherFM SchumacherFM Merge remote-tracking branch 'upstream/master'
* upstream/master:
  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
  2.0.0.0-dev53 * Moved general action-related functionality to \Magento\App\Action\Action in the library. Removed Magento\Core\Controller\Varien\Action and related logic from the Magento_Core module * Moved view-related methods from action interface to \Magento\App\ViewInterface with corresponding implementation * Moved redirect creation logic from the action interface to \Magento\App\Response\RedirectInterface * Moved Magento\Core common blocks to the library * Added reading of etc/integration/config.xml and etc/integration/api.xml files for API Integrations * Various improvements:   * Email-related logic from the Core and Adminhtml modules consolidated in the new Email module * GitHub requests:   * [#238](#238) -- Improve escaping HTML entities in URL   * [#199](#199) -- Replaced function calls to array_push with adding the elements directly   * [#182](#182) -- By default use collection _idFieldName for toOption* methods.   * [#233](#233) -- Google Rich Snippet Code   * [#339](#339) -- Correcting 'cahce' typo in documentation.   * [#232](#232) -- Update app/code/core/Mage/Checkout/controllers/CartController.php (fix issue #27632) * Fixed bugs:   * Fixed JavaScript error when printing orders from the frontend   * Fixed Captcha problems on various forms when Captcha is enabled on the frontend   * Fixed "Page not found" on category page if setting "Add Store Code to Urls" to "Yes" in the backend config   * Fixed Fatal error when creating shipping label for returns
  2.0.0.0-dev52 * Better Navigation menu rendering due to improved Caching of Categories * Added Magento\Filesystem\Directory and Magento\Filesystem\File to the library * Various improvements:   * Added a static test to check for incorrect dependencies in the library   * Moved Magento\Core\Model\Theme to the Magento\View component   * Moved Magento\Core\Model\Design to the Magento\View component   * Consistent declaration of page-types   * The Framework part of the Cache functionality moved out from modules * Themes update:   * Updated templates and layout updates in the Captcha, Customer, Newsletter, Persistent, ProductAlert, Wishlist modules; old files moved to the "magento-backup" theme   * Refactored and removed duplicate Persistent module templates   * Plushe theme made responsive * Fixed bugs:   * Fixed inability to print order, invoice, or creditmemo in the frontend   * Fixed fatal error caused by the Mage_Backend_Block_System_Config_FormTest integration test   * Fixed the broken link when the MAP feature is enabled and actual product price is set to be displayed in the shopping cart * Moved the following methods from Core Helpers to the appropriate libraries:   * Moved the Data Helper date format related functions to \Magento\Core\Model\Locale   * Moved the Data Helper array decoration related functions to Magento\Stdlib\ArrayUtils   * Moved the Data Helper functions that copy data from one object to another to \Magento\Object\Copy
4b15176
@Nas1k Nas1k referenced this pull request from a commit
@mage2-team mage2-team 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
789face
@Nas1k Nas1k referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@Nas1k Nas1k referenced this pull request from a commit
@mage2-team mage2-team (split Module_Customer)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
db39f5b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 22, 2013
  1. @mrploddy

    Update Merge.php

    mrploddy authored
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 app/code/core/Mage/Core/Model/Layout/Merge.php
View
4 app/code/core/Mage/Core/Model/Layout/Merge.php
@@ -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){

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ $layoutStr .= $fileXml->innerXml();
+ }
}
$layoutStr = '<layouts>' . $layoutStr . '</layouts>';
$layoutXml = simplexml_load_string($layoutStr, $this->_elementClass);
Something went wrong with that request. Please try again.