Post by parkookk » Wed Mar 22, 2023 8:49 pm

Hi,
I have OC3.0.3.1 and I got these errors, I searched online with no luck. Can someone please help?

PHP Notice: A non well formed numeric value encountered in:

/catalog/controller/product/category.php on line 342, 332, 157
/system/library/pagination.php on line 57, 54, 94
/catalog/controller/product/search.php on line 408, 185
storage/modification/catalog/controller/product/product.php on line 833, 812

PHP Notice: Trying to access array offset on value of type bool in /catalog/controller/product/special.php on line 84, 91, 96, 109, 115, 117, 118, 122, 123, 124
Last edited by parkookk on Fri Mar 31, 2023 6:52 pm, edited 1 time in total.

User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Expert Member

Posts

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

Post by JNeuhoff » Thu Mar 23, 2023 9:09 pm

This error could be caused by the usage of PHP 8 which isn't supported by OC 3.0.3.1. Use PHP 7.4 or 7.3.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by parkookk » Fri Mar 24, 2023 6:42 pm

JNeuhoff wrote:
Thu Mar 23, 2023 9:09 pm
This error could be caused by the usage of PHP 8 which isn't supported by OC 3.0.3.1. Use PHP 7.4 or 7.3.
Thanks, I am using PHP 7.4, so the error is not related to PHP version.

User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by parkookk » Fri Mar 24, 2023 6:46 pm

ADD Creative wrote:
Thu Mar 23, 2023 4:14 am
The following may help.

https://github.com/opencart/opencart/pull/8688

viewtopic.php?t=229934
Thanks "ADD Creative", I followed your link and it was quite difficult to understand the page, however, after clicking the "files changed" tab, it took me to https://github.com/opencart/opencart/pull/8688/files, and I changed all those files and still getting the same error.

User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by parkookk » Fri Mar 24, 2023 7:30 pm

Ok, I think I got it now,
So I need to edit all the following files:
/catalog/controller/product/category.php manufacturer.php product.php search.php special.php

and change
}

if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}

to

}

if (isset($this->request->get['page'])) {
$page = (int)$this->request->get['page'];
} else {
$page = 1;
}

Basically, adding (int) to make the $page integer. Does that cause issue if the number goes negative?

Also what about these files?

/system/library/pagination.php
storage/modification/catalog/controller/product/product.php

User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by ADD Creative » Fri Mar 24, 2023 8:18 pm

Yes, you just have to add (int) in front of $this->request->get['page'] for all those files.

Negative number shouldn't matter as the warnings are caused by bots setting the page to non-numeric values.

system/library/pagination.php won't be an issue if the (int) in added in the other files.
Once you have made the changes, refresh your modifications. This will then correct storage/modification/catalog/controller/product/product.php.

www.add-creative.co.uk


Expert Member

Posts

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

Post by parkookk » Fri Mar 31, 2023 6:52 pm

ADD Creative wrote:
Fri Mar 24, 2023 8:18 pm
Yes, you just have to add (int) in front of $this->request->get['page'] for all those files.

Negative number shouldn't matter as the warnings are caused by bots setting the page to non-numeric values.

system/library/pagination.php won't be an issue if the (int) in added in the other files.
Once you have made the changes, refresh your modifications. This will then correct storage/modification/catalog/controller/product/product.php.
Thanks, so far so good :dance:

User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london
Who is online

Users browsing this forum: No registered users and 36 guests