Published: May 22, 2019
Last updated:

Cannot redeclare Mage_Core_Helper_String::unserialize() in app/code/core/Mage/Core/Helper/String.php

Problem description

Magento Checkout is blank/empty after installing SUPEE-10415, the following error logged in PHP error log:
PHP Fatal error: Cannot redeclare Mage_Core_Helper_String::unserialize() in app/code/core/Mage/Core/Helper/String.php on line 505 

Cause

app/code/core/Mage/Core/Helper/String.php file got patched twice (either due to manual action or by file upload from another Magento version). As result, unserialize() function is defined twice and causing fatal error.

Solution

Delete extra definition of unserialize() function in app/code/core/Mage/Core/Helper/String.php file:
--- app/code/core/Mage/Core/Helper/String.php
+++ app/code/core/Mage/Core/Helper/String.php
@@ -496,25 +496,5 @@
         return $this->_arrayHelper;
     }
 
-    /**
-     * UnSerialize string
-     * @param $str
-     * @return mixed|null
-     * @throws Exception
-     */
-    public function unserialize($str)
-    {
-        $reader = new Unserialize_Reader_ArrValue('data');
-        $prevChar = null;
-        for ($i = 0; $i < strlen($str); $i++) {
-            $char = $str[$i];
-            $result = $reader->read($char, $prevChar);
-            if (!is_null($result)) {
-                return $result;
-            }
-            $prevChar = $char;
-        }
-    }
-



If you have any difficulties with solving this problem or got a similar one, please let us know in comments below, so we can find the solution together.

Posted in: Fatal errors, supee-10415

47 votes, 4.79 avg. rating (95% score)