[wp-trac] [WordPress Trac] #45933: WSODs protection returns incorrect content type for JSON Requests
WordPress Trac
noreply at wordpress.org
Thu Jan 17 19:41:35 UTC 2019
#45933: WSODs protection returns incorrect content type for JSON Requests
--------------------------------------------------+------------------------
Reporter: spacedmonkey | Owner: flixos90
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 5.1
Component: Bootstrap/Load | Version: trunk
Severity: normal | Resolution:
Keywords: servehappy needs-patch needs-testing | Focuses: multisite
--------------------------------------------------+------------------------
Comment (by flixos90):
@spacedmonkey Sounds good. Some small issues with
[attachment:"45933.6.diff"]:
* The code is rather complicated to follow. If the preparing function
already handles `$message` and `$args`, it should also handle `$title`,
which also relies on the same process and that preparation is currently
hard-coded only in the default wp-die-handler.
* If you pass a `WP_Error` without `status` set in `$data`, the code will
currently break, overriding the original `$data` and thus effectively
deleting `$data['status']`.
* The preparing function must never override `$args` because it would also
erase additional arguments. It should ensure that things like `back_link`,
`link_url` and `link_text` are maintained as well.
* The function lacks docs.
* Generally, the function's behave would be much more obvious by doing the
following:
{{{
function _wp_die_process_input( $message, $title, $args ) {
// all the logic here
return array( $message, $title, $args );
}
}}}
This way you could write `list( $message, $title, $args ) =
_wp_die_process_input( $message, $title, $args )`, done. Straightforward
and no more custom processing required by the individual handlers.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45933#comment:30>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list