Post by dxer » Thu Dec 21, 2017 2:17 am

Hi
I was performing Opencart switch to https protocol on Opencart 1.5.6.x after which now I am having problem when I want to login to admin page.
Admin page is displaying this error:
Notice: unserialize(): Error at offset 687 of 8748 bytes in /home/xxxx/public_html/admin/index.php on line 51

This code is on line 51:
$config->set($setting['key'], unserialize($setting['value']));

How can I fix this problem ?
Thanks
Last edited by dxer on Thu Dec 21, 2017 2:35 am, edited 1 time in total.

New member

Posts

Joined
Thu Dec 13, 2012 10:32 pm

Post by straightlight » Thu Dec 21, 2017 2:23 am

If you wish to do this without upgrading, replace all instances of:

Code: Select all

serialize
with:

Code: Select all

json_encode
and:

Code: Select all

unserialize
replace with:

Code: Select all

json_decode
This should rectify the problem.

Although, I would still recommend to upgrade as well as your PHP version along with mySQL.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by dxer » Thu Dec 21, 2017 2:35 am

You mean all instances in admin/index.php file ?
there is only one "serialized" and one "unserialize" and i replaced like you said but then error is:
Notice: Undefined index: json_encode in /home/xxxx/public_html/admin/index.php on line 48

this is complete code from index.php

foreach ($query->rows as $setting) {
if (!$setting['serialized']) {
$config->set($setting['key'], $setting['value']);
} else {
$config->set($setting['key'], unserialize($setting['value']));
}
}

New member

Posts

Joined
Thu Dec 13, 2012 10:32 pm

Post by straightlight » Thu Dec 21, 2017 2:37 am

Your PHP version might be very outdated. I would not suggest to run a live store in those conditions until upgrading your PHP version, mySQL version to mySQLi library as well as your OC version. Contact your host to upgrade the first two libraries to the most recent possible versions.

Those changes are for the entire platform. Not just index.php file.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by dxer » Thu Dec 21, 2017 2:59 am

For now I just need to fix this error. It was all working fine before I switched to https protocol. So , how can I fix this ?

PHP on server is 5.6.31 , mySQL is 5.5.57, this all should be fine for Opencart 1.5.6.x , I mean it was all working fine.

Is there a easy way to upgrade Opencart 1.5.6.x to Opencart 2 ?

New member

Posts

Joined
Thu Dec 13, 2012 10:32 pm

Post by straightlight » Thu Dec 21, 2017 3:05 am

Is there a easy way to upgrade Opencart 1.5.6.x to Opencart 2 ?
Between v1.5x releases and v2.x releases, those are the longest to upgrade but it can be done. If you do not wish to take any chances to do the process on your own and acquire assistance, it can also be done as a custom job.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 20 guests