Make WordPress Core

Ticket #29542: 29542.2.diff

File 29542.2.diff, 1.3 KB (added by jesin, 11 years ago)

Removes 29620, includes 29542.diff

  • src/wp-includes/pluggable.php

     
    16921692 * @param string|int $action Should give context to what is taking place and be the same when nonce was created.
    16931693 * @return bool Whether the nonce check passed or failed.
    16941694 */
    1695 function wp_verify_nonce($nonce, $action = -1) {
     1695function wp_verify_nonce( $nonce, $action = -1 ) {
     1696        $nonce = (string) $nonce;
    16961697        $user = wp_get_current_user();
    16971698        $uid = (int) $user->ID;
    16981699        if ( ! $uid ) {
     
    17071708                $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
    17081709        }
    17091710
    1710         if ( empty( $nonce ) ) {
    1711                 return false;
    1712         }
    1713 
    17141711        $token = wp_get_session_token();
    17151712        $i = wp_nonce_tick();
    17161713
  • tests/phpunit/tests/auth.php

     
    9999                $this->assertFalse( wp_verify_nonce( '' ) );
    100100                $this->assertFalse( wp_verify_nonce( null ) );
    101101        }
     102
     103        /**
     104         * @ticket 29542
     105         */
     106        function test_wp_verify_nonce_with_integer_arg() {
     107                $this->assertFalse( wp_verify_nonce( 1 ) );
     108        }
    102109}