Im constantly seeing the following error in system.log I've gone into the file but cant see anything wrong can any one help me?

Warning: strlen() expects parameter 1 to be string, array given in /app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php on line 93

  • Do you use an old version of Amasty Order Attributes? :-) Upgrade the extension. May 28, 2014 at 10:46
  • @FabianBlechschmidt Nope ive never used that module we have used the promo items though? May 28, 2014 at 10:56
  • I know this error from the OrderAttributes extension, but maybe it happens there too... May 28, 2014 at 12:15
  • Which concrete Magento version are you using? Jan 21, 2019 at 17:43
  • @RaulSanchez it was some version of 1.9 probably 1.9.2.x any way onto M2 now Jan 21, 2019 at 17:46

2 Answers 2


This is from my copy ( of app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php

_getOptionText is returning an array, not a string like the code is clearly expecting. I'd see what class getFrontend is returning and then see how that can be returning an array.

protected function _getOptionText($optionId)
    return $this->getAttributeModel()->getFrontend()->getOption($optionId);

 * Apply attribute option filter to product collection
 * @param   Zend_Controller_Request_Abstract $request
 * @param   Varien_Object $filterBlock
 * @return  Mage_Catalog_Model_Layer_Filter_Attribute
public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
    $filter = $request->getParam($this->_requestVar);
    if (is_array($filter)) {
        return $this;
    $text = $this->_getOptionText($filter);
    if ($filter && strlen($text)) {
        $this->_getResource()->applyFilterToCollection($this, $filter);
        $this->getLayer()->getState()->addFilter($this->_createItem($text, $filter));
        $this->_items = array();
    return $this;
  • +1 someone who offers some decent advice and explains how to understand the problem, not a hack.
    – Ash
    May 28, 2014 at 13:36

strlen() is a function which gives the length of the string you passed as a parameter.

The error is that you must be passing an array in the strlen(). Please check the value you are passing. It should be string.

Check your file "Attribute.php" at line no. 93.

  • 2
    downvoted - because stating the obvious and rewording the error in laymans terms doesn't really answer the question. I'm presuming the point of the question is more understanding why Magentos' Core is fragmented.
    – Ash
    May 28, 2014 at 13:33
  • Upvote, I don't see why this answer couldn't be valid Jan 21, 2019 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.