2 years ago
#22417
Boštjan Podvratnik
Fatal Error after upgrading Magento 1.9.3.1 to PHP7
After upgrading PHP to 7.0 Magento show the following error message:
Fatal error: Uncaught TypeError: Argument 2 passed to Mage::dispatchEvent() must be of the type array, object given, called in /var/www/izdelam.si/public_html/app/code/local/Gitscripts/Title/Model/Observer.php on line 9 and defined in /var/www/izdelam.si/public_html/app/Mage.php:448
Stack trace:
#0 /var/www/izdelam.si/public_html/app/code/local/Gitscripts/Title/Model/Observer.php(9): Mage::dispatchEvent('title_assignmen...', Object(Varien_Event_Observer))
#1 /var/www/izdelam.si/public_html/app/code/core/Mage/Core/Model/App.php(1358): Gitscripts_Title_Model_Observer->applyTitle(Object(Varien_Event_Observer))
#2 /var/www/izdelam.si/public_html/app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Gitscripts_Title_Model_Observer), 'applyTitle', Object(Varien_Event_Observer))
#3 /var/www/izdelam.si/public_html/app/Mage.php(451): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#4 /var/www/izdelam.si/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(350): Mag in /var/www/izdelam.si/public_html/app/Mage.php on line 448
The code that seems to have the issue, is the function applyTitle()
that is located into the file Observer.php
, and it looks like this:
[...]
public function applyTitle($observer){
$head = $observer->getLayout()->getBlock('head');
if($head){
$this->setData('title',Mage::getSingleton('title/title'));
}
Mage::dispatchEvent('title_assignment_before',$observer);
Mage::Register('current_title',Mage::getSingleton('title/title'));
$title = $this->getData('title');
if($title){
$head->setTitle($title->getTitle());
}
return $this;
}
[...]
Could you help me to understand what is wrong with this code?
magento-1.9
php-7
0 Answers
Your Answer