Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't save new matrix block type in Craft 3.4.1 #5554

Open
ryanmwc opened this issue Jan 31, 2020 · 16 comments
Open

Can't save new matrix block type in Craft 3.4.1 #5554

ryanmwc opened this issue Jan 31, 2020 · 16 comments

Comments

@ryanmwc
Copy link

ryanmwc commented Jan 31, 2020

Description

I had created a matrix field earlier in the week with several block types while in version 3.3.x and then updated to version 3.4.1 yesterday. Sometime after the update, I created a new block type, added a field, and saved it, then I got an error. From the logs:

2020-01-31 01:18:17 [-][1][op4ovmv6f9nluvrgh8poqhbdat [error][yii\base\ErrorException:1] yii\base\ErrorException: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in /Users/me/Sites/MWC/vendor/yiisoft/yii2/base/ErrorException.php:43
Stack trace:
#0 /Users/me/Sites/MWC/vendor/craftcms/cms/bootstrap/web.php(51): ::unknown()
#1 /Users/me/Sites/MWC/web/index.php(20): ::unknown()
#2 {main}
2020-01-31 01:18:15 [-][1][op4ovmv6f9nluvrgh8poqhbdat][info][application] $_GET = [
    'p' => 'mwclogin/settings/fields/edit/37'
]

I had googled around searching for Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini but a few SO responses said that increasing the limit was not the right thing to do, that it's a solution to the wrong problem.

Steps to reproduce

  1. Create a matrix field in version 3.3.x
  2. Update to 3.4.1
  3. Add a new block type to existing matrix field
  4. Add a text field
  5. Save the field
  6. See the error

Here's a gif:

matrix-block-bug

Just to be clear what's going on in the gif, I'm scrolling down to create a new block type in my existing matrix field called "Test", I create a new plain text field called "Test", and I save the field and see the error.

Additional info

  • Craft version: 3.4.1
  • PHP version: 7.3.9
  • Database driver & version: MySQL 5.6.21
@nettum
Copy link
Contributor

nettum commented Jan 31, 2020

This error is pretty common (regardless of craft 3.4) if your matrix is getting big (e.g. with supertables inside your matrix and lots of linkfield fields).
I'm pretty sure you will need to up the max_input_vars variable in your php settings. At least until craft finds a better way to save field-settings data. Any ETA on this @brandonkelly? Craft 4?

@brandonkelly
Copy link
Member

That error was added in 21d13d4, per #876. It actually gives you an opportunity to increase max_input_vars, and then reload the browser window, which will resubmit all of your changes exactly as they were initially submitted, this time hopefully without hitting the same server limitation.

We do plan to fix this in the long run by making the form post JSON data rather than serialized form data, so the max_input_vars will stop applying.

@JoppeDC
Copy link

JoppeDC commented Mar 25, 2020

Not sure if this issue should be closed. It's a pretty serious issue and needs a fix. I'm guessing it might get lost in the closed list.

@JayBox325
Copy link
Contributor

Agreed, this should be left open. Having this issue today.

@withoutwax
Copy link

Was wondering if there's an update for this issue! I'm currently facing the same problem as well - where Craft doesn't allow me to save adding new matrix blocks, most likely due to large number of nested blocks within.

@brandonkelly brandonkelly removed this from the 4.0 milestone Apr 23, 2021
@brandonkelly brandonkelly reopened this Apr 23, 2021
@brandonkelly brandonkelly added this to the 4.0 milestone Apr 23, 2021
@brandonkelly brandonkelly removed this from the 4.0 milestone Jun 3, 2022
@smunusamy
Copy link

Now with Craft 4 released, any update on this issue?
We are currently facing this problem as well, where Craft doesn't allow us to save adding new matrix blocks.

@brandonkelly
Copy link
Member

We weren’t able to fix this in Craft 4, however there’s another possible fix we’re going to look into for Craft 5.

In the meantime you can still work around it by increasing PHP’s max_input_vars.

@Abbe91
Copy link

Abbe91 commented Jan 18, 2023

I have increasing php's max_input_vars to 7000 but I have the same problem

@brianjhanson
Copy link
Contributor

@Abbe91 & @rspilhaus just to confirm, is the error you're getting also an "Input variables exceeded ... " error? Or are you getting a different error?

@sam-netlogix
Copy link

We're currently experiencing this issue at my organisation too, we've upped the default max_input_vars value to 2000 (doubling it) and this hasn't had the desired effect.

Running v3.7.26 of Craft CMS so due an update for sure but as I understand it this doesn't have a fix yet in any later version.

Is there an official workaround that can be applied? Or a recommended value to apply to that property in php.ini?

@brandonkelly
Copy link
Member

@sam-netlogix If you’re getting the same exact error message (Input variables exceeded 1000), then the max_input_vars change wasn’t made correctly, or the web server needs to be restarted for it to apply.

@sam-netlogix
Copy link

@sam-netlogix If you’re getting the same exact error message (Input variables exceeded 1000), then the max_input_vars change wasn’t made correctly, or the web server needs to be restarted for it to apply.

The change is actually reflected in the PHP Info section under Utilities, and the error message now shows "Input variables exceeded 2000" instead of 1000, web server was restarted after we applied the change. I think the change was applied successfully.

@brandonkelly
Copy link
Member

@sam-netlogix Can you try going all the way to 10000 and see if that helps?

@sam-netlogix
Copy link

@brandonkelly this seems to have resolved our issue for now 👍

Is a permanent fix for this planned for a future release?

@brandonkelly
Copy link
Member

@sam-netlogix Glad to hear. We had hoped to solve in 4.0 but it didn’t make the cut, so we’ll see if we can get this resolved for 5.0. (The fix would be a breaking change, so can’t happen mid-release cycle.)

@martin-coded
Copy link

martin-coded commented Sep 16, 2023

A little warning in the System Report would be nice. Similar to the Memory Limit or Max Execution Time warnings. Probably it's hard to define a minimum, but it seems 1'000 is too low for many projects.

I just checked the settings from different projects, which are hosted on cheap shared hostings. The standard max_input_vars settings are between 1'000 to 200'000...

Oh sorry, this is only an issue during development, so changing the max_input_vars should never be a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests