Post by SecurityHardware1 » Wed Aug 04, 2021 6:43 pm

Hello,

We are currently having an issue with our website where customers are having the below code appear when on our site:

Notice: Trying to access array offset on value of type bool in /customers/3/5/a/security-hardware.co.uk/httpd.www/system/library/tax.php on line 11Notice: Trying to access array offset on value of type bool in /customers/3/5/a/security-hardware.co.uk/httpd.www/system/library/tax.php on line 11

Line 11 Code - $this->setShippingAddress($this->session->data['shipping_address']['country_id'], $this->session->data['shipping_address']['zone_id']);

We currently run OC on v 2.1.0.1 and are on PhP version 7.4 due to some plugins which don't quite work with the later versions.

Can someone assist with any changes which may need to be made to the line of code in order to solve the issue?

Thanks in advance!


Posts

Joined
Wed Mar 17, 2021 7:01 pm

Post by ADD Creative » Wed Aug 04, 2021 7:48 pm

It's just a notice,. but if you are seeing it on screen, then you probably have display errors on. Not only will this cause problems like the one you are seeing, it is also a security risk. You need to ensure display errors is switched off in three places.
In the settings.
In system/config/default.php.
In you PHP configuration. Should be off by default, but there are some bad server configurations out there. Use phpinfo() to check.

If you want to stop the log file filling up try in system/library/tax.php changing.

Code: Select all

if (isset($this->session->data['shipping_address'])) {
To.

Code: Select all

if (isset($this->session->data['shipping_address']['country_id']) && isset($this->session->data['shipping_address']['zone_id'])) {
And the same for payment_address.

www.add-creative.co.uk


Expert Member

Posts

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

Post by SecurityHardware1 » Wed Aug 04, 2021 8:19 pm

Thanks for your reply. I've turned it off in the System settings, so isn't showing on the page any more. It may sound a daft question but by not displaying the error logs, this won't cause any further issues?

In terms of the phpinfo(), I'm not particularly 'code-friendly' although I know my way around the site structure files. On the line, the code you mentioned is in line 10, the error was throwing to line 11. By changing line 10 to contain the given code, should this stop the error?


Posts

Joined
Wed Mar 17, 2021 7:01 pm

Post by ADD Creative » Wed Aug 04, 2021 8:59 pm

The errors should still be logged they just won't be displayed. Displaying errors is just for debugging and can cause problems with live stores. You also need to switch off in system/config/default.php.

You need a .php file with the following in your hosting directory. Then go to that file in an web browser. Remember to delete the file afterwards.

Code: Select all

<?php
phpinfo();
?>
Yes, changing line 10 will stop the error, because line 11 will be skipped if the variable it needs isn't there.

www.add-creative.co.uk


Expert Member

Posts

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

Post by SecurityHardware1 » Fri Aug 06, 2021 8:54 pm

Thanks for your help, this seems to have been resolved with the site now.


Posts

Joined
Wed Mar 17, 2021 7:01 pm

Post by straightlight » Fri Aug 06, 2021 9:04 pm

SecurityHardware1 wrote:
Fri Aug 06, 2021 8:54 pm
Thanks for your help, this seems to have been resolved with the site now.
Now that the issue has been solved, please add: [SOLVED] at the beginning of the subject line on your first post.

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