Skip to content

Commit 6b33930

Browse files
committed
fixed error (object to string conversion), better message
1 parent 67060e1 commit 6b33930

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

app/code/core/Mage/Core/Model/Layout.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,12 @@ protected function _getBlockInstance($block, array $attributes = [])
503503
}
504504
}
505505
if (class_exists($block, false) || mageFindClassFile($block)) {
506-
// phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation
507506
$block = new $block($attributes);
508507
}
509508
}
510509
if (!$block instanceof Mage_Core_Block_Abstract) {
511-
Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $block));
510+
$block = is_object($block) ? get_class($block) : $block;
511+
Mage::throwException(Mage::helper('core')->__('Invalid block type: %s (not instance of Mage_Core_Block_Abstract)', $block));
512512
}
513513
return $block;
514514
}

app/locale/en_US/Mage_Core.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
"Invalid URL scheme.","Invalid URL scheme."
176176
"Invalid base url type","Invalid base url type"
177177
"Invalid block type: %s","Invalid block type: %s"
178+
"Invalid block type: %s (not instance of Mage_Core_Block_Abstract)","Invalid block type: %s (not instance of Mage_Core_Block_Abstract)"
178179
"Invalid block: %s","Invalid block: %s"
179180
"Invalid connection","Invalid connection"
180181
"Invalid date","Invalid date"

0 commit comments

Comments
 (0)