I am currently setting a Magento v1.7 ecommerce store on nginx with PHP 5.4. I have been monitoring the Magento store for errors and have been getting a few of them. I wanted to make a list of the errors that I am getting with the fixes. I hope these fixes will help other. And of course, please comment if you have a few to add to the list or if the fix on the post is not correct.

ERR (3): Warning: Illegal string offset 'value'  in /app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field.php on line 111

I have been getting the above error in saving configuration in backend.
Fix:
Replace at line 111:

} elseif ($v['value']==$defText) {
    $defTextArr[] = $v['label'];
    break;
}

To:

} elseif (isset($v['value'])) {
    if ($v['value']==$defText) {
        $defTextArr[] = $v['label'];
        break;
    }
}

If you have problem with Magento not generating PDF form invoice or anything PDF related.

You may need to open up: /lib/Zend/Pdf/FileParserDataSource.php
and comment out:

//abstract public function __construct();
//abstract public function __destruct();

Check out page problems with Log in and quantity updates.
By inserting:

<?php echo $this->getBlockHtml('formkey'); ?>

Right after:

<form id="login-form">

You may need to use grepWin to search for the location with the error, your theme may vary.

15 Responses

  1. Hi did you find any other issues using PHP 5.4 with 1.7 magento e-commerce community? I am surprised there are not more developers mentioning issues with 5.4 and mage installs as it is being a bit weird for me right now! đŸ™‚

  2. Wow what a great find! This fix worked and honestly I’m quite surprised I could find something on this system error within the first few search results!

  3. I also found issues with lib/Zend. PHP 5.4.x and up has a more stricter ruleset for inheritance and i found many lib/Zend classes break. This is because Magento has not updated the Zend library for some time now.

    Tested this on Magento CE 1.8.1.0 and EE 1.13.1.0 and both have the same issue. It is recommended that you use PHP 5.3.x as per Magento.

    We are currently using PHP 5.4.4 and patching our Magento instance as we go along. I can also confirm that the “Illegal string offset ‘value'” error is an issue in 5.4.x and that this fix works.

    1. Yes, you are right. When enough errors comes along, it makes me want to install the PHP 5.3.X. Now that business is settling down, I need to resume on those errors. Time to upgrade to 1.8.1.0 as well. Thank you for your comment.

  4. Thank you, thank you, thank you! My PDF invoices would not print any more after moving web hosts until I found this fix. You’re a STAR!

  5. The error ERR (3): Warning: Illegal string offset 'value' in /app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field.php on line 111 is really from the inconsistent implementation of toOptionArray in the following two models:

    Mage_Paypal_Model_System_Config_Source_PaymentActions
    Mage_Paypal_Model_System_Config_Source_PaymentActions_Express

    If you override each of those models and replace the toOptionArray method with this one, it resolves the error without modifying the core code unnecessarily.

    	/**
    	 * Fix core code so method return structure matches method name standard return structures.
    	 *
    	 * @see Mage_Paypal_Model_System_Config_Source_PaymentActions::toOptionArray()
    	 * @see Varien_Data_Collection::toOptionArray()
    	 */
    	public function toOptionArray()
    	{
    		$retval = array();
    		$options = parent::toOptionArray();
    		foreach ($options as $v => $l)
    		{
    			$retval[] = array
    			(
    				'label' => $l,
    				'value' => $v
    			);
    		}
    		return $retval;
    	}
  6. Two more models which need the same overriding are:
    Mage_Paypal_Model_System_Config_Source_RequireBillingAddress
    Mage_Paypal_Model_System_Config_Source_Logo

  7. Hi Guys, Just to mention that the proposed fix distorts the logic of the condition so you would be better fixing it with the following:–

    This:- } elseif ($v[‘value’]==$defText) {

    Becoming:- } elseif (isset($v[‘value’]) && $v[‘value’]==$defText) {

    The above fixes the error.

  8. This `ERR (3): Warning: Illegal string offset ‘value’ in /app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field.php on line 111` was masked in Magento 1.9.x.x.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.