[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:48:29 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
-----------------------------------------+-------------------------------

Comment (by dilipbheda):

 @SirLouen I checked your suggestion — it allows zero as well. If we want
 to allow only positive numbers, we should do it like this:
 {{{ ( isset( $_POST['position'] ) && $_POST['position'] > 0 ) }}}

 Let me know your thoughts

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63445#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list