Opened 5 weeks ago
Last modified 4 weeks ago
#63147 accepted defect (bug)
Enhanced verification of $_REQUEST['reauth'] in the authentication process.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.9 | Priority: | low |
Severity: | normal | Version: | |
Component: | Login and Registration | Keywords: | has-patch |
Focuses: | Cc: |
Description
The $_REQUEST['reauth']
check currently uses a more up-to-date syntax:
<?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 $reauth = !empty($_REQUEST['reauth']);
Use coalescent Null operator :
<?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 🙂
Attachments (2)
Change History (7)
#1
@
5 weeks ago
- Keywords needs-testing removed
- Milestone changed from Awaiting Review to 6.8
- Owner set to audrasjb
- Status changed from new to accepted
- Type changed from enhancement to defect (bug)
- Version trunk deleted
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
4 weeks ago
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
4 weeks ago
Note: See
TracTickets for help on using
tickets.
Hello and thanks for the ticket @wplmillet,
Switching this to a bugfix and milestoning to 6.8.
Please note that the patch doesn't pass WordPress Coding Standards tests because we'll need spaces after and before opening and closing parenthesis, and also between
!
andempty()
:)