[wp-trac] [WordPress Trac] #31515: Cannot enable plugins with protected function redeclarations (PHP Fatal Error)

WordPress Trac noreply at wordpress.org
Tue Mar 3 18:48:19 UTC 2015


#31515: Cannot enable plugins with protected function redeclarations (PHP Fatal
Error)
--------------------------+-----------------------------
 Reporter:  brokentone    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Plugins       |    Version:  3.9.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I'm working on a codebase where the theme or plugins concurrently declare
 the same function inside a function_exists() however the original plugin
 defines the function without a function_exists check. In this situation,
 all the declarations can live together at runtime, but attempting to
 activate (or reactivate) the original plugin causes an error.

 Since the plugin initialization sandbox occurs after wp is loaded, the
 other plugins (with their checks) will have filled the function, any
 additional function declarations will fail. However this is merely an
 artifact of the initialization system -- as this plugin is being
 artificially run much later than it will be regularly running.

 A usecase -- perhaps you are trying to wean yourself off the Advanced
 Custom Fields plugin so you've implemented the get_field function in the
 theme's functions file in a function_exists check. After disabling the ACF
 plugin, you decided to reenable it to adjust a field. Game over, Fatal
 Error.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31515>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list