[wp-hackers] Bug in 2.7 ? => error message on plugin activation, how to ?

andré renaut andre.renaut at gmail.com
Mon Dec 15 14:27:33 GMT 2008


DD32, well trunk may have some bugs, but 2.7 also have ...

Apparently in 2.7 when calling plugins.php with error_scrape, most of the wp
api is not loaded anymore, leading to this kind of message :

Plugin could not be activated because it triggered a *fatal error*.
Sorry, but you can't run this plugin.
Your PHP version is '5.2.5', at least version '6.2.0' required. (well that
is for test purpose !)
*Fatal error*: Call to undefined function deactivate_plugins() in *
C:\Vn\wp27\wp-content\plugins\mailpress*

And the result is that the Plugin gets ACTIVATED !!!!

What my code looks like :

add_action('activate_myplugin.php', 'install');
if (isset($_GET['action']) && ('error_scrape' == $_GET['action']))
{
    install(false,false);
    deactivate_plugins($_GET['plugin']);
    die();
}

    install($install=true, $trigger=true) {

        $min_ver_php = '6.2.0';
        $m = array();

        if (version_compare(PHP_VERSION, $min_ver_php, 'ge')) ;
        else
        {
            $install = false;
             $m[] .= sprintf(__('Your %1$s version is \'%2$s\', at least
version \'%3$s\' required.'), 'PHP', PHP_VERSION, $min_ver_php );
        }

        if ($install)     include ('install.php');
        else
        {
            $err  = __("Sorry, but you can't run this plugin.");
            $err .= '<br/>' . implode('<br/>',$m);
//trigger a fatal error
            if ($trigger) trigger_error('', E_USER_ERROR);
            else echo $err;
        }
    }

I am going to make a plugin test and post a ticket.

I also had a message like this one :
Fatal error: Call to undefined function wp_get_current_user() in
C:\Vn\wp27\wp-includes\capabilities.php on line 920 (ticket #8624)


More information about the wp-hackers mailing list