I recently got a email from a plugin developer, with regards to him having compatibility issues with one of the plugins I had developed. It turned out that both our plugins used a popular library called PCLZip for adding archiving features. Due to the compatibility issue, accessing his plugin would cause a fatal PHP error saying that the PCLZip class cannot be re-declared, when both our plugins were activated.
The compatibility issue arose because of two things;
A mistake on his part while checking for existence of class objects in the code.
A mistake on my part of using custom libraries, instead of using those provided by WordPress core.
Here is a code snippet used to check for class existence.
if(! function_exists(’class_name’)) { require_once(’myclass.php’); } $object = new class_name();
The above code is wrong, since:
Class names […]
Original post by Keith Dsouza
Technorati Tags: blog
Related Posts: