[wp-trac] [WordPress Trac] #63147: Enhanced verification of $_REQUEST['reauth'] in the authentication process.
WordPress Trac
noreply at wordpress.org
Sat Mar 22 13:23:12 UTC 2025
#63147: Enhanced verification of $_REQUEST['reauth'] in the authentication process.
------------------------------------+-------------------------------------
Reporter: wplmillet | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Login and Registration | Version: trunk
Severity: normal | Keywords: has-patch needs-testing
Focuses: |
------------------------------------+-------------------------------------
The `$_REQUEST['reauth']` check currently uses a more up-to-date syntax:
{{{#!php
<?php
$reauth = empty( $_REQUEST['reauth'] ) ? false : true;
}}}
This syntax could be updated to improve the code's readability and
robustness. Two options are possible:
Use {{{empty()}}} :
{{{#!php
<?php
$reauth = !empty($_REQUEST['reauth']);
}}}
Use coalescent Null operator :
{{{#!php
<?php
$reauth = $_REQUEST['reauth'] ?? false;
}}}
**Advantages :**
- Better readability.
- Reduces redundant code.
- Modern PHP practices.
I'll be using more of the first solution with empty() seems to be better.
It avoids the undesirable behavior associated with falsy values
({{{0}}},{{{''}}}, ).
**Impact:**
No negative impact expected. No change in behavior and better code
readability. and maintenance.
Thank you 🙂
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63147>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list