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

PHP Fatal errors: Cannot redeclare CMB2 multiple select box & date range field functions #672

Open
charmoney opened this issue Jul 9, 2019 · 3 comments

Comments

@charmoney
Copy link

Description

BadgeOS includes the CMB2 multiple select box & date range fields without checking if they are already loaded. (Though the BadgeOS date range field appears to be a non-object oriented copy of the code predating WDS adding it to GitHub.) On existing WordPress sites that already use CMB2 and those field types, this causes PHP Fatal errors like:

PHP Fatal error: Cannot redeclare cmb2_render_select_multiple_field_type()

This is not an issue with CMB2. which safely loads itself only as needed. The issue is specifically with BadgeOS' loading of community produced additional field types for CMB2.

Steps to Reproduce

  1. Start with a stock WP installation
  2. Copy the CMB2 multiple select box field file mu-plugins.
  3. Download, install, and activate the & date range field plugin.
  4. Install BadgeOS
  5. Activate BadgeOS through the WP admin plugins page
  6. Encounter PHP fatal errors

Actual result:

WP crashes fatally when running BadgeOS and other plugins that use the multiple select or date range custom field types.

Expected result:

WP works when running BadgeOS and other plugins that use the multiple select or date range custom field types.

Product Versions

  • BadgeOS: 2.4
  • WordPress: 5.2.2

Additional Information

N/A

charmoney added a commit to charmoney/badgeos that referenced this issue Jul 9, 2019
Fixes issue opencredit#672. Only load CMB2 multiple selectbox & date range fields if their functions do not already exist.
@charmoney
Copy link
Author

Verified this fatal PHP error still occurs after PR #677 and the wordpress.org release of version 3.0.

@charmoney
Copy link
Author

Verified this fatal PHP error still occurs after PR #704 and the wordpress.org release of version 3.3.

@charmoney
Copy link
Author

Verified this fatal PHP error still occurs after the wordpress.org release of version 3.3.

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

1 participant