Make WordPress Core

Opened 17 years ago

Closed 15 years ago

#5166 closed defect (bug) (invalid)

use wp_die instead of echo/exit pair

Reported by: nbachiyski's profile nbachiyski Owned by: westi's profile westi
Milestone: Priority: low
Severity: minor Version: 2.3
Component: General Keywords: has-patch
Focuses: Cc:

Description

In tow places in wp-admin errors are taken from WP_Error object and are just printed and the script ends.

Thus it is both not very beautoful and doesn't issue the correct encoding headers. Using wp_die solves both problems.

Attachments (1)

wp_die-insteadof-echo-exit.diff (1.1 KB) - added by nbachiyski 17 years ago.

Download all attachments as: .zip

Change History (7)

#1 @westi
17 years ago

  • Owner changed from anonymous to westi
  • Status changed from new to assigned

+1 to the first change

Can we change admin-ajax.php like that as we a returning the error to js not the browser?

#2 follow-up: @ryan
17 years ago

Maybe add a WP_Error::die_with_message() method?

#3 in reply to: ↑ 2 @westi
17 years ago

Replying to ryan:

Maybe add a WP_Error::die_with_message() method?

Cute

It might be nice if we can come up with something nice to replace the following:

if ( is_wp_error($result) )
{
    wp_die( $result->get_error_message() );
}

It would nice if all occurrances of the above could become oneliners like:

wp_die_if_wp_error($result);

#4 @santosj
17 years ago

if( is_wp_error( $result ) )
{
    $result->die_with_message('');
}

Pretty, short, and sweet

#5 @Denis-de-Bernardy
15 years ago

maybe even change is_wp_error() to die automatically?

#6 @Denis-de-Bernardy
15 years ago

  • Milestone 2.9 deleted
  • Resolution set to invalid
  • Status changed from accepted to closed

can't find any trace of die statements in there.

Note: See TracTickets for help on using tickets.