Make WordPress Core

Changeset 30576


Ignore:
Timestamp:
11/26/2014 07:18:02 PM (12 years ago)
Author:
ocean90
Message:

Type cast $nonce to string in wp_verify_nonce().

props jesin.
fixes #29542.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pluggable.php

    r30544 r30576  
    16961696 * @return bool Whether the nonce check passed or failed.
    16971697 */
    1698 function wp_verify_nonce($nonce, $action = -1) {
     1698function wp_verify_nonce( $nonce, $action = -1 ) {
     1699        $nonce = (string) $nonce;
    16991700        $user = wp_get_current_user();
    17001701        $uid = (int) $user->ID;
  • trunk/tests/phpunit/tests/auth.php

    r30471 r30576  
    7070        /**
    7171         * Test wp_hash_password trims whitespace
    72          * 
    73          * This is similar to test_password_trimming but tests the "lower level" 
     72         *
     73         * This is similar to test_password_trimming but tests the "lower level"
    7474         * wp_hash_password function
    75          * 
     75         *
    7676         * @ticket 24973
    7777         */
     
    100100                $this->assertFalse( wp_verify_nonce( '' ) );
    101101                $this->assertFalse( wp_verify_nonce( null ) );
     102        }
     103
     104        /**
     105         * @ticket 29542
     106         */
     107        function test_wp_verify_nonce_with_integer_arg() {
     108                $this->assertFalse( wp_verify_nonce( 1 ) );
    102109        }
    103110
Note: See TracChangeset for help on using the changeset viewer.