Make WordPress Core

Ticket #24063: ticket-24063-req-nonce-action.2.patch

File ticket-24063-req-nonce-action.2.patch, 1.7 KB (added by bpetty, 12 years ago)
  • src/wp-includes/functions.php

    diff --git src/wp-includes/functions.php src/wp-includes/functions.php
    index 32fe225..d62e0b2 100644
    function is_blog_installed() { 
    11971197 * @return string Escaped URL with nonce action added.
    11981198 */
    11991199function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) {
     1200        if ( -1 == $action )
     1201                _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action as the second parameter.' ), '3.9' );
     1202
    12001203        $actionurl = str_replace( '&', '&', $actionurl );
    12011204        return esc_html( add_query_arg( $name, wp_create_nonce( $action ), $actionurl ) );
    12021205}
    function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) { 
    12301233 * @return string Nonce field.
    12311234 */
    12321235function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
     1236        if ( -1 == $action )
     1237                _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action as the first parameter.' ), '3.9' );
     1238
    12331239        $name = esc_attr( $name );
    12341240        $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
    12351241
  • src/wp-includes/pluggable.php

    diff --git src/wp-includes/pluggable.php src/wp-includes/pluggable.php
    index 9fe26d5..b739bc4 100644
    if ( !function_exists('check_ajax_referer') ) : 
    828828 * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5)
    829829 */
    830830function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {
     831        if ( -1 == $action )
     832                _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.9' );
     833
    831834        $nonce = '';
    832835
    833836        if ( $query_arg && isset( $_REQUEST[ $query_arg ] ) )