Post by RideTheWave » Thu Jul 02, 2020 7:30 am

I'm on OC 2.3.0.2. In my error log, I see the following error:

Code: Select all

PHP Warning:  A non-numeric value encountered in /home/xxx/public_html/vqmod/vqcache/vq2-catalog_controller_product_category.php on line 378
There are a few of these lines and the line number might change (like instead of line 378 there are some that say line 187, 386, 390).

Does anyone have any idea what could be causing this? This is a complete guess but it could be related to a PHP version change. When the site was first created, it was on PHP 5.6 but then I changed it to PHP 7.3. There were a few fixes I had to make to make the site work on 7.3 but in general everything looks the same. Could this have anything to do with it?

New member

Posts

Joined
Fri May 19, 2017 8:29 am

Post by paulfeakins » Thu Jul 02, 2020 6:50 pm

Well what's on that line in that file?

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


User avatar
Legendary Member
Online

Posts

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

Post by RideTheWave » Fri Jul 03, 2020 2:48 am

That line 378 reads:

Code: Select all

	$data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit));
Line 187 reads:

Code: Select all

'start'              => ($page - 1) * $limit,
Line 386 reads:

Code: Select all

	    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page - 1), true), 'prev');
Line 390 reads:

Code: Select all

  $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1), true), 'next');
All of those lines contain the $page variable so that may have something to do with it. What does the $page variable do and how is it possible that it ever becomes a non-numeric value? Do you think this is related to the php version change?

New member

Posts

Joined
Fri May 19, 2017 8:29 am

Post by OSWorX » Fri Jul 03, 2020 3:47 am

Same file when $page is initiated, use:

Code: Select all

(int) $page

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria
Who is online

Users browsing this forum: No registered users and 16 guests