in Technology

WordPress 2.7: Fixing ‘Fatal error’ with Automatic Upgrade

A few days ago I installed WordPress 2.7 RC1 on one of my blogs to get a feel for the new interface. One of the awesome new features of WP 2.7 is the built-in upgrade feature, a feature that the very cool WordPress Automatic Upgrade plugin has handled for me up until now.

I was eager to try the new built-in upgrade feature, so when WP 2.7 was officially released I rushed to upgrade the RC1 blog (Tools -> Upgrade). To my surprise however, I was shown something that did not even remotely look like a success message:

Fatal error: Cannot redeclare class pclzip in /home/homeproj/public_html/wp-admin/includes/class-pclzip.php on line 171

After a little research, I discovered the problem was the WordPress Automatic Upgrade plugin! Both the WPAU plugin and the built-in upgrade functionality of WordPress 2.7 must declare the same pclzip class. This means you cannot have the WPAU plugin active and use the built-in upgrade functionality of WP 2.7 at the same time.

To fix the problem, you simply need to deactivate the WordPress Automatic Upgrade plugin.

If you don’t have the WPAU plugin installed, you can try deactivating all of your plugins to see if any of them are causing a conflict.

Write a Comment

Comment

16 Comments

  1. change file /wp-admin/includes/file, line 484 (2.7.1) as follows

    from
    require_once(ABSPATH . ‘wp-admin/includes/class-pclzip.php’);

    to

    if(! class_exists(‘PclZip’)) { require_once(ABSPATH . ‘wp-admin/includes/class-pclzip.php’);}

  2. Thanks very much for this information. I had no problem originally installing 2.7 because I was a new user, but trying to upgrade today I got this message. WordPress support is suggesting making code changes…This is much easier and worked perfectly.

  3. I’d rather disable the “built-in” functionality since the plug-in at least handles my database backups. This one doesn’t and merely provides a link to an article on the WordPress site talking about the importance of such backups.

    I suppose you can lump me in with “non-plussed” group.

    • You’re absolutely correct Adrian. I think it’s really silly that WordPress doesn’t backup the database for you, especially since its such an easy thing to do! Hopefully we’ll see that functionality built-in on a future release!

  4. Incidentally, uploading plugin zip files were also failing on me, same error message – same issue.

    Funny that I searched Google and ended up here…at a post I am pretty sure I read when it was published =p

      • At least it’s better than the flip side. I recall at work coming across something like this

        [bad code
        more bad code
        spaghetti code]

        At this point I’m thinking, who wrote this?! So I scroll up and find something like this

        /* Comment – I know this is poorly done, but I need to get this out for blah blah release blah blah lame excuse etc etc …. – SS */

        At which point, one has two options: fix the code, or modify the file to attribute the comment to someone else =P

        • Haha, I dread the thought of looking at any of my old code.

          On the other hand, it helps me realize how far I’ve come and how much I’ve learned. I can’t believe there was a point where I was writing production PHP code without understanding what REGISTER_GLOBALS was used for… (lots of old code broke when PHP was upgraded and the default was changed to REGISTER_GLOBALS=off; I had used $post_var instead of $_POST['post_var']… doh!).