Bug? Cannot redeclare a pluggable function (4 posts)

  1. harrym
    Posted 6 years ago #

    I just upgraded to 2.8.2 and now a plugin I wrote has broken:

    Plugin could not be activated because it triggered a fatal error.

    Fatal error: Cannot redeclare wp_authenticate() (previously declared in [...]/wp-includes/pluggable.php:456) in [...]/plugins/myplugin/login.php on line 64

    Is this a bug? Or am I doing something wrong?

    For now I've just commented out wp_authenticate in pluggables.php, but that's not a very good solution!

  2. harrym
    Posted 6 years ago #

    Bump. Anyone?

  3. raymorris
    Posted 6 years ago #

    Did you get this figured out, Harry? If so, would you please
    share the solution with the rest of us who are having the same problem?

  4. Andrew Nacin
    Lead Developer
    Posted 5 years ago #

    When a plugin goes through the activation process, it gets included *after* pluggable.php gets included. During the load process, it gets included before.

    Any plugin overriding a pluggable function should take care to wrap their function definition in a function_exists check, not only to play nice with the activation process, but also with other plugins.

Topic Closed

This topic has been closed to new replies.

About this Topic