Post by Cue4cheap » Thu Sep 29, 2022 10:48 am

Ok I have a good one and here are the steps to reproduce:
Create an option name (aka category) - Lets say we create "Color" since there can be hundreds of colors
Edit said option name to add in the different options, Add in all the colors of the spectrum but create 249 of them! (or just add in numbers 1 - 249 to make it easy).
Save
Go back into that same option name and add in one more option.
Save
Go look in your error log.

Code: Select all

2022-09-28 2:58:11 - PHP Warning:  Undefined array key "option_value_description" in /home2/store/public_html/oc38/test/admin/controller/catalog/option.php on line 393
2022-09-28 2:58:11 - PHP Warning:  foreach() argument must be of type array|object, null given in /home2/store/public_html/oc38/test/admin/controller/catalog/option.php on line 393
2022-09-28 2:58:11 - PHP Warning:  Undefined array key "image" in /home2/store/public_html/oc38/test/admin/model/catalog/option.php on line 42
2022-09-28 2:58:11 - PHP Warning:  Undefined array key "sort_order" in /home2/store/public_html/oc38/test/admin/model/catalog/option.php on line 42
2022-09-28 2:58:11 - PHP Warning:  Undefined array key "option_value_description" in /home2/store/public_html/oc38/test/admin/model/catalog/option.php on line 49
2022-09-28 2:58:11 - PHP Warning:  foreach() argument must be of type array|object, null given in /home2/store/public_html/oc38/test/admin/model/catalog/option.php on line 49
Go back into that option name (aka category) and you will see one of the "Option value names" is blank (most likely the last one you entered).

This was done with a fresh install of OC3.0.3.8 and on my live site of 2.3.0.2.
Granted I have one server I am able to use and I have not changed around my settings in .htaccess or php.ini to try and see if there are changes I can make but I do not see any errors anywhere reported except for opencart's logs.
Mike
Last edited by Cue4cheap on Fri Sep 30, 2022 6:14 am, edited 1 time in total.

cue4cheap not cheap quality


Active Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by ADD Creative » Thu Sep 29, 2022 7:01 pm

What do you have post_max_size, max_input_time and max_input_vars set to in your PHP settings? You won't see any other errors than the ones in your log if these were too small.

www.add-creative.co.uk


Expert Member

Posts

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

Post by Cue4cheap » Thu Sep 29, 2022 7:31 pm

ADD Creative thank you for the reply.
They are:
post_max_size = 516M
max_input_time = 60
max_input_vars = 1000
Mike

cue4cheap not cheap quality


Active Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by paulfeakins » Thu Sep 29, 2022 7:50 pm

As above this is most likely a hosting limit rather than anything to do with OC.

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom

Post by ADD Creative » Thu Sep 29, 2022 8:04 pm

Every option value requires 4 input variables, option_value_id, name, image and sort_order. If you have max_input_vars set to 1000 that will allow 249 values ((1000 - 3) / 4 = 249.25).

www.add-creative.co.uk


Expert Member

Posts

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

Post by Cue4cheap » Thu Sep 29, 2022 8:36 pm

ADD Creative wrote:
Thu Sep 29, 2022 8:04 pm
Every option value requires 4 input variables, option_value_id, name, image and sort_order. If you have max_input_vars set to 1000 that will allow 249 values ((1000 - 3) / 4 = 249.25).
Well how about that? That is awesome reply and knowledge.
Thank you and I hope this helps others as it took me a bit of trail and error to understand why all of a sudden this issue popped up. I'll change that setting later today and test again but the math makes 100% sense.

Thank you again,
Mike

cue4cheap not cheap quality


Active Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by Cue4cheap » Fri Sep 30, 2022 6:15 am

That was it. I don't know how many people will run into this but glad it is solved.

cue4cheap not cheap quality


Active Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by paulfeakins » Fri Sep 30, 2022 6:48 pm

Cue4cheap wrote:
Thu Sep 29, 2022 8:36 pm
I'll change that setting later today
You might as well set it really high, I don't think there are major downsides.

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom

Post by ADD Creative » Fri Sep 30, 2022 9:30 pm

paulfeakins wrote:
Fri Sep 30, 2022 6:48 pm
You might as well set it really high, I don't think there are major downsides.
The downside would be that PHP would be more vulnerable to a kind of denial of service attack.
https://www.php.net/manual/en/info.conf ... input-vars

www.add-creative.co.uk


Expert Member

Posts

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

Post by xxvirusxx » Sat Oct 01, 2022 1:35 pm

Cue4cheap wrote:
Thu Sep 29, 2022 10:48 am
2022-09-28 2:58:11 - PHP Warning: foreach() argument must be of type array|object, null given in
Based on this warning, you have >= PHP 8.0

My Converted Modules | Opencart Upgrade Service | Free Dashboard Maps | Buy me a beer | My Custom OC 3.0.3.8


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by Cue4cheap » Sun Oct 02, 2022 12:17 am

xxvirusxx wrote:
Sat Oct 01, 2022 1:35 pm
Cue4cheap wrote:
Thu Sep 29, 2022 10:48 am
2022-09-28 2:58:11 - PHP Warning: foreach() argument must be of type array|object, null given in
Based on this warning, you have >= PHP 8.0
That is correct and the reason I installed the OC3.0.3.8 and updating to the maintenance branch. I am adapting all of my scripts from 2.3.0.2 over the next couple of months before I make the switch to be ready for PHP 8.1 and above.
Mike

cue4cheap not cheap quality


Active Member

Posts

Joined
Fri Sep 20, 2013 4:45 am
Who is online

Users browsing this forum: Zath and 27 guests