Post by drrevans » Sat Jan 01, 2022 1:35 pm

I upgraded to opencart 2.03.1. I am getting unserialized() error at offset 0 to t in index.php. I found the line of code. It is the following:
foreach ($query->rows as $setting) {
if (!$setting['serialized']) {
$config->set($setting['key'], $setting['value']);
} else {
$config->set($setting['key'], unserialize($setting['value'])); <=== error is on this line

So I changed that line to this to see the output: $config->set($setting['key'], unserialize($setting['value'])); if (!unserialize($setting['value'])) echo $setting['key']."==>".$setting['value']."<hr>";

I get these 2 errors:
Notice: unserialize(): Error at offset 0 of 5 bytes in C:\xampp\htdocs\store\admin\index.php on line 39
config_complete_status==>["5"]

Notice: unserialize(): Error at offset 0 of 5 bytes in C:\xampp\htdocs\store\admin\index.php on line 39
config_processing_status==>["2"]

I started with a fresh database so these are values put in by the install. Does those errors mean that the value should be serialized or no?

I have attached what those entries look like in the database.

Attachments

serialized.png

serialized.png (72.87 KiB) Viewed 2638 times


New member

Posts

Joined
Mon Nov 29, 2021 1:31 am

Post by ADD Creative » Sat Jan 01, 2022 11:31 pm

That's not serialized data it looks more like JSON encoded. JSON is used in later versions of OpenCart. It looks like you have got something mixed up somewhere.

What versions are you upgrading from and to?

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by drrevans » Sun Jan 02, 2022 5:01 am

ADD Creative wrote:
Sat Jan 01, 2022 11:31 pm
That's not serialized data it looks more like JSON encoded. JSON is used in later versions of OpenCart. It looks like you have got something mixed up somewhere.

What versions are you upgrading from and to?
The current version is 1.4.9. I was trying to get it to 2.3.X before going to the latest version. I read that 2.X doesn't use serialize but JSON but I haven't been able to find how I upgrade my 1.4.9 to that.

New member

Posts

Joined
Mon Nov 29, 2021 1:31 am

Post by ADD Creative » Sun Jan 02, 2022 6:54 am

2.1.0.0 was the first version to use JSON for the settings. It sounds like you have already run the updater of a later version, but your index.php is from 2.0.3.1 or earlier.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by drrevans » Sun Jan 02, 2022 7:19 am

ADD Creative wrote:
Sun Jan 02, 2022 6:54 am
2.1.0.0 was the first version to use JSON for the settings. It sounds like you have already run the updater of a later version, but your index.php is from 2.0.3.1 or earlier.
I will try to get 2.3 to work but I thought I was seeing the same code in the index..php

New member

Posts

Joined
Mon Nov 29, 2021 1:31 am
Who is online

Users browsing this forum: No registered users and 126 guests