[wp-trac] [WordPress Trac] #59384: `wp_create_nonce()` should not have a default parameter
WordPress Trac
noreply at wordpress.org
Mon Sep 18 12:13:31 UTC 2023
#59384: `wp_create_nonce()` should not have a default parameter
-------------------------+-----------------------------
Reporter: bor0 | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
If `wp_create_nonce()` is called multiple times, it will produce the same
nonce, since `wp_create_nonce`'s `$action` defaults to `-1`.
This might be against the developer's expectation "I called this twice,
should get a different nonce", so it might be interpreted as a security
trap in a way.
{{{#!php
wp> wp_create_nonce()
=> string(10) "6f11a1efea"
wp> wp_create_nonce()
=> string(10) "6f11a1efea"
}}}
This is a minor issue/devex improvement, just being more explicit about
the nonce's action.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59384>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list