[wp-trac] [WordPress Trac] #63445: Replace value casting with ! empty() check for positive value validation
WordPress Trac
noreply at wordpress.org
Wed May 14 12:35:38 UTC 2025
#63445: Replace value casting with ! empty() check for positive value validation
-----------------------------------------+-------------------------------
Reporter: dilipbheda | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version:
Severity: normal | Resolution:
Keywords: has-patch changes-requested | Focuses: coding-standards
-----------------------------------------+-------------------------------
Changes (by SirLouen):
* keywords: has-patch => has-patch changes-requested
Comment:
@dilipbheda if I'm not wrong its even cleaner to use the null coalescing
operator
Look how clean it can be:
{{{
$position = (int) ($_POST['position'] ?? '-1');
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63445#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list