Post by megalca » Mon Aug 15, 2022 11:47 pm

Hi all
Happy Monday!
Using open cart 3.0.3.3 on php7.4 using basel theme.
Today I signed up as a customer on a testing/demo account and noticed this message:
Any ideas?
thanks a lot!

Notice: Trying to access array offset on value of type bool in /home/public_html/storage/modification/catalog/controller/startup/startup.php on line 187Notice: Trying to access array offset on value of type bool in /home/public_html/storage/modification/catalog/controller/startup/startup.php on line 187

New member

Posts

Joined
Sun Apr 07, 2019 5:49 am

Post by megalca » Tue Aug 16, 2022 12:16 am

This is the part:
// Tax
$this->registry->set('tax', new Cart\Tax($this->registry));

if (isset($this->session->data['shipping_address'])) {
$this->tax->setShippingAddress($this->session->data['shipping_address']['country_id'], $this->session->data['shipping_address']['zone_id']);
} elseif ($this->config->get('config_tax_default') == 'shipping') {
$this->tax->setShippingAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}

Line 187 is: $this->tax->setShippingAddress($this->session->data['shipping_address']['country_id'], $this->session->data['shipping_address']['zone_id']);

New member

Posts

Joined
Sun Apr 07, 2019 5:49 am

Post by thekrotek » Tue Aug 16, 2022 3:25 am

Probably, "shipping_addess" session array is not present.

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


Expert Member

Posts

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

Post by megalca » Tue Aug 16, 2022 1:00 pm

Thanks a lot ADD Creative!
Sorry not expert.... should I just rename the file startup.php to application.php and replace the complete code (or add the new code lines(green))?
Will that change affect the rest of the open cart code?
I have open cart 3.0.3.3
thanks!

New member

Posts

Joined
Sun Apr 07, 2019 5:49 am

Post by ADD Creative » Tue Aug 16, 2022 4:59 pm

I would just remove the red lines and add the green for now. Remember to take a backup first.

If your site is a live site you need to switch off displaying of errors. Then look in you logs for errors.

You need make sure display errors in set to off in all 3 places. Your PHP settings, in system/config/default.php and in the settings. Not only can this cause minor notices and warnings to cause bigger errors, as you have seen, it can also be a security risk.

1. In your PHP settings make sure display_errors is set to Off. Use phpinfo() to check. It should be off by default, but there are lots of rubbish hosts out there.

2. In system/config/default.php set error_display to false.

3. In your OpenCart Setting on the server tab set Display Errors to No.

www.add-creative.co.uk


Expert Member

Posts

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

Post by megalca » Tue Aug 16, 2022 9:55 pm

Appreciate a lot you taking the time to give such a detailed explanation. Thanks!
After removing the red code and adding the green code, should I should I rename the file startup.php to application.php and uploaded it back to:
/home/public_html/storage/modification/catalog/controller/startup/ ?

New member

Posts

Joined
Sun Apr 07, 2019 5:49 am

Post by megalca » Tue Aug 16, 2022 10:22 pm

Basically just want to know if the change in the name of the file will not mess up the rest of the open cart 3.0.3.3 installation that calls for the startup.php (old file name)
thanks

New member

Posts

Joined
Sun Apr 07, 2019 5:49 am

Post by ADD Creative » Tue Aug 16, 2022 11:54 pm

There is no need to change the name of the file. I'm not sure where you have that name from.

1. Backup your site and database.

2. Download your catalog/controller/startup/startup.php file from your server or edit on the server.

3. Change.

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.

Code: Select all

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

Code: Select all

if (isset($this->session->data['payment_address']['country_id']) && isset($this->session->data['payment_address']['zone_id'])) {
4. Upload your changed catalog/controller/startup/startup.php to the server or save if editing on the server.

5. Refresh your modifications.

www.add-creative.co.uk


Expert Member

Posts

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

Post by megalca » Wed Aug 17, 2022 12:44 am

Thanks for the clear explanation!
I came with the file name change form here:
https://i.imgur.com/tBtrw9L.png
Not expert so guess that doesn't mean a file name change

New member

Posts

Joined
Sun Apr 07, 2019 5:49 am

Post by ADD Creative » Wed Aug 17, 2022 1:48 am

It does mean a name change, but it not the change I linked to, which does not include a name change.

www.add-creative.co.uk


Expert Member

Posts

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

Post by megalca » Wed Aug 17, 2022 4:00 am

Ok got it!
thanks!!

New member

Posts

Joined
Sun Apr 07, 2019 5:49 am
Who is online

Users browsing this forum: No registered users and 108 guests