• Resolved Chris

    (@web2guru)


    The redirect function should have a more unique name so it doesn’t cause conflicts. All plugins should make sure all of their functions names are unique, so I posted this on another plugin that uses the same function name, Adminer which produces the error, “Fatal error: Cannot redeclare redirect()…”.

    https://www.ads-software.com/plugins/dooodl/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author noCreativity

    (@nocreativity)

    Hi Web2Guru,

    Thanks for pointing that out.
    Could you post the full error-message?

    I’m currently working on an entirely new version (backend-wise). So I’ll take this into account as well.

    Thread Starter Chris

    (@web2guru)

    Sure thing. The error doesn’t actually come up in your plugin, it is only seen when another plugin also tries to create a function with the same name. One such plugin is Adminer, a phpMyAdmin plugin – I posted a similar topic in their forum. Here is the full error (home folder account id replaced):

    Fatal error: Cannot redeclare redirect() (previously declared in /home/content/99/99999999/html/wp-content/plugins/dooodl/Dooodl.php:921) in /home/content/99/99999999/html/wp-content/plugins/adminer/inc/adminer/include/functions.inc.php on line 512

    Plugin Author noCreativity

    (@nocreativity)

    Hi Web2Guru,

    Sorry for that insanely late reply of mine.
    I’m currently working on a new version of Dooodl. It will also take into account that no more of these conflicts happen anymore.

    If you have experience in PHP/WordPress, you can go into the Dooodl plugin and search for all functions that are called ‘redirect’ and rename them to ‘dooodl_redirect’. That should fix the problem for now.

    What happened here was that I built this plugin way back in the day when I wasn’t aware of so many thing that I am now. What I did was I wrote this plugin using simple names. Names that anybody could use. The problem with that is that other plugin developers could have done the same thing (which happened in your case). So both him/her and me both defined a function redirect (which might do completely different things) in our own plugins/themes. The problem is that when WP is run, the same function name is used twice to define 2 different functions. That’s causes the error above.

    This will soon be fixed with the release of Dooodl 2.0.
    Promise!

    Thread Starter Chris

    (@web2guru)

    No problem, I just wanted to bring the issue up in hopes that it would get fixed in a future version – great to hear that it is already in the works.

    Yep, I am a PHP/WordPress developer, I build plugins and modify plugins, so that is exactly what I did (to either Dooodl or Adminer, I don’t recall).

    How is Dooodl 2.0 going? It would be great if it had more paint tools and users could vote for their favourite Dooodls.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Please Use Unique Function Names’ is closed to new replies.