DOING_AUTOSAVE E_WARNING

The wp-includes/post.php file contains 4 error suppressors. The wp_save_post_revision function contains the line

if ( @constant( 'DOING_AUTOSAVE' ) )

When it is defined, it is when the wp-admin/admin-ajax.php file's _wp_ajax_delete_comment_response function defines it as boolean true. This is the only other place where the DOING_AUTOSAVE constant can be found within the WordPress core files.

Because I can see no reason why this couldn't be written as

if ( defined( 'DOING_AUTOSAVE' ) && constant( 'DOING_AUTOSAVE' ) )

I left a Trac Ticket, but as of yet, it is still unanswered.

UPDATE: As of WordPress 2.9 this E_WARNING error has been fixed. The line is now

if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
Technorati Tags: ,

2 Comments

  1. Giles
    Posted September 17, 2009 at 12:12 pm | Permalink

    I wish the WP team would be a bit more rigorous about coding standards. WP throws slews of E_NOTICE errors, which might not be annoying on a standard PHP config but which makes it very frustrating to embed into a site which has a stricter error reporting level.

    Don't even get me started on the huge list of global variables it uses – like $request, which is like dropping $email into the global namespace and hoping nobody else wanted to use that variable.

    Really, doing v3 properly (e.g. OO, everything neatly encapsulated and modular) would be a revelation. They could provide an optional file which defined legacy global functions & variables so that themes didn't break.

  2. Posted September 17, 2009 at 8:52 pm | Permalink

    I find that most of the E_NOTICE errors result from WordPress continuing it's support for PHP 4

    I don't really understand why anyone would still want to use old PHP after this long, but I'm guessing it's similar to some users not ugrading WordPress even when it's for a security patch.