How to fix "Call to a member function toHtml() on a non-object" in Magento 1.4

Have you upgraded your Magento store to Magento 1.4.x, only to see the following error message in the error logs?

PHP Fatal error:  Call to a member function toHtml() on a non-object in .../app/code/core/Mage/Core/Model/Layout.php on line 529

The reason for this error is a change to the template engine introduced with Magento Luckily, there is a simple fix. To upgrade your template/theme for Magento 1.4, follow these steps:

In file app/design/frontend/<package_name>/<theme_name>/layout/page.xml, replace:

<block type="core/profiler" output="toHtml"/>
<block type="core/profiler" output="toHtml" name="core_profiler"/>

(Replace <package_name> and <theme_name> with the folders relevant to your installation)

Finally, clear your cache and the problem should be solved.

Was this answer helpful?