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

Fatal Error when saving certain Metabox Groups #451

Open
mikeselander opened this issue Mar 27, 2018 · 1 comment
Open

Fatal Error when saving certain Metabox Groups #451

mikeselander opened this issue Mar 27, 2018 · 1 comment
Assignees
Labels

Comments

@mikeselander
Copy link
Contributor

I haven't been able to trace this much deeper yet, but I get fatal errors on my local machine when a group is attempting to save without any data passed to it.

Stack trace:

[27-Mar-2018 20:32:53 UTC] PHP Fatal error:  Uncaught Error: Call to a member function set_values() on null in /chassis/wp-content/mu-plugins/custom-meta-boxes/fields/class-cmb-group-field.php:266
Stack trace:
#0 /chassis/wp-content/mu-plugins/custom-meta-boxes/fields/class-cmb-group-field.php(227): CMB_Group_Field->set_values(Array)
#1 /chassis/wp-content/mu-plugins/custom-meta-boxes/fields/class-cmb-field.php(397): CMB_Group_Field->parse_save_values()
#2 /chassis/wp-content/mu-plugins/custom-meta-boxes/class-cmb-meta-box.php(566): CMB_Field->save(25877, Array)
#3 /chassis/wp-content/mu-plugins/custom-meta-boxes/class-cmb-meta-box.php(592): CMB_Meta_Box->save(25877)
#4 /chassis/wordpress/wp-includes/class-wp-hook.php(300): CMB_Meta_Box->save_for_post(25877)
#5 /chassis/wordpress/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array)
#6 /chassis/wordpress/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#7 /chassis/wordpress/wp-includes/post.php(3510): do_action('save_post', 25877, Object(WP_Post), true)
#8 /chassis/wordpress/wp-i in /chassis/wp-content/mu-plugins/custom-meta-boxes/fields/class-cmb-group-field.php on line 266
@mikeselander mikeselander self-assigned this Mar 27, 2018
@mikeselander
Copy link
Contributor Author

I've tracked this down a bit more and certainly an edge case. I've identified 2 situations where this could occur.

  1. When there are multiple metabox groups with the same ID, but differing sets of fields (i.e. one of the groups has one more field than the others). Doesn't matter if they're assigned to different pages or not.
  2. When switching branches locally. Specifically, if you have a branch that has a new metabox group, you open an edit page, switch branches to a branch that doesn't have that group registered, and then hit save on the open edit page. (See, I told you this was edge case)

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

No branches or pull requests

1 participant