2
votes

We have a customer, who wanted to integrate Dokuwiki into Wordpress in a way, that only users, who are logged in in Wordpress have access to the wiki. So I wrote a Dokuwiki Authentication Plugin which includes the necessary Wordpress corefiles to check the login state.

My problem is Wordpress as well as Dokuwiki both have a function is_ssl() and it results in an "Fatal error: Cannot redeclare ..". Quick and dirty approach was to edit Wordpress corefile by adding if(!function_exists('is_ssl')) in /wp-includes/load.php. Despite of the fact, that this shouldn't be done it has to be reentered every time Wordpress gets an update, but I can't come up or find a better solution.

1

1 Answers

1
votes

Ideally both projects should use proper namespacing to avoid these problems. But both projects are also ancient (from PHP4 times) and have large user bases which means changes can only be introduced slowly and carefully with taking care of backwards compability.

There is no good solution for your problem except some esoteric php extensions like runkit that allow for redefining or renaming functions.

Your best approach is to send a pull request to Wordpress and/or DokuWiki asking them to integrate your function_exists check. DokuWiki might be a little bit easier to approach ;-)

Disclaimer: DokuWiki author here