Post by motion2082 » Mon Mar 19, 2018 2:46 pm

Getting a strange message in the error log every few seconds

Code: Select all

[19-Mar-2018 06:32:39 UTC] PHP Notice:  unserialize(): Error at offset 55 of 88 bytes in /home/xxx/public_html/index.php on line 58
Anyone seen this before?

Line 58 of index.php is part of a for loop

Code: Select all

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

Active Member

Posts

Joined
Tue May 12, 2015 8:48 pm

User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by motion2082 » Mon Mar 19, 2018 3:14 pm

Interesting, wonder what the easiest way to fix it is?

Active Member

Posts

Joined
Tue May 12, 2015 8:48 pm

Post by thekrotek » Mon Mar 19, 2018 4:34 pm

Hard to say. You need to find out, which value causes the error first.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by motion2082 » Mon Mar 19, 2018 7:03 pm

Inherited this from another developer FML

Active Member

Posts

Joined
Tue May 12, 2015 8:48 pm

Post by paulfeakins » Tue Mar 20, 2018 6:24 pm

motion2082 wrote:
Mon Mar 19, 2018 7:03 pm
Inherited this from another developer FML
Maybe try re-saving the settings?

The database stores the length of the serialised string, so if someone has tried to edit something directly in the database without adjusting that number then this could happen.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by motion2082 » Tue Mar 20, 2018 6:45 pm

paulfeakins wrote:
Tue Mar 20, 2018 6:24 pm
Maybe try re-saving the settings?
The database stores the length of the serialised string, so if someone has tried to edit something directly in the database without adjusting that number then this could happen.
Spot on Paul, I reckon it might have something to do with the previous developer putting this in the store META tag description

Code: Select all

<meta name="description" content="73948923501249184901248-149-3-2593-40">

Active Member

Posts

Joined
Tue May 12, 2015 8:48 pm

Post by motion2082 » Tue Mar 20, 2018 7:43 pm

Bugger that wasn't it :(

Active Member

Posts

Joined
Tue May 12, 2015 8:48 pm

Post by straightlight » Tue Mar 20, 2018 9:10 pm

This error is caused due to a positive PHP upgrade which obviously no longer supports the serialize / unserialize function. Upgrading your OC version would be ideal in this case since some of the core functions in OC have been changed over the years.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by motion2082 » Tue Mar 20, 2018 10:06 pm

Agreed, just need to convince the store owner that :laugh:

Active Member

Posts

Joined
Tue May 12, 2015 8:48 pm

Post by straightlight » Tue Mar 20, 2018 10:08 pm

An alternative solution would be to use TextCrawler and to rename all instances of:

Code: Select all

serialize
to:

Code: Select all

json_encode
and:

Code: Select all

unserialize
to:

Code: Select all

json_decode
which can be done in a few secs by using the batch replace function. Although, ensure to make a full backup of your store and its database before proceeding.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by motion2082 » Tue Mar 20, 2018 10:16 pm

Until I see how serious the owner is about investing in upgrading his current store Im not touching anything that requires hours of work.

Appreciate the suggestion, I just rolled him back to PHP 5.3 for now

Active Member

Posts

Joined
Tue May 12, 2015 8:48 pm

Post by IP_CAM » Tue Mar 20, 2018 10:29 pm

Well, I am not so sure about this, since even the latest OC v.3.0.2.x contains just
about 100 Files, containing that serialize + unserialize. And what would
have to be done with that if (!$result['serialized']) { ??
Ernie
Image

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by straightlight » Tue Mar 20, 2018 10:30 pm

which can be done in a few secs
Until I see how serious the owner is about investing in upgrading his current store Im not touching anything that requires hours of work.

Appreciate the suggestion, I just rolled him back to PHP 5.3 for now

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by straightlight » Tue Mar 20, 2018 10:31 pm

The serialize functions from JS files have no impact with the ones being used with PHP.

With OC v3.0.2.0 release, only these files uses serialize:

Code: Select all

system/elfinder/jquery/jquery-1.12.4.js
system/elfinder/jquery/jquery-ui-1.12.0.js
system/elfinder/js/elFinder.mimetypes.js
admin/view/javascript/jquery/jquery-2.1.1.min.js
catalog/view/javascript/jquery/jquery-2.1.1.min.js
install/view/javascript/jquery/jquery-2.1.1.min.js
admin/view/javascript/jquery/flot/jquery.js
admin/view/javascript/jquery/flot/jquery.min.js
admin/view/javascript/jquery/jquery-ui/jquery-ui.js
admin/view/javascript/jquery/jquery-ui/jquery-ui.min.js
admin/view/javascript/jquery/datetimepicker/moment/tests.js
catalog/view/javascript/jquery/datetimepicker/moment/tests.js
admin/view/javascript/jquery/flot/examples/axes-time-zones/date.js
admin/view/javascript/jquery/jquery-ui/external/jquery/jquery.js

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


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 70 guests