[wp-trac] [WordPress Trac] #63445: Replace value casting with ! empty() check for positive value validation

WordPress Trac noreply at wordpress.org
Wed May 14 13:58:22 UTC 2025


#63445: Replace value casting with ! empty() check for positive value validation
-----------------------------------------+-------------------------------
 Reporter:  dilipbheda                   |       Owner:  (none)
     Type:  defect (bug)                 |      Status:  closed
 Priority:  normal                       |   Milestone:
Component:  Comments                     |     Version:
 Severity:  normal                       |  Resolution:  wontfix
 Keywords:  has-patch changes-requested  |     Focuses:  coding-standards
-----------------------------------------+-------------------------------

Comment (by SirLouen):

 Replying to [comment:11 dilipbheda]:
 > > @dilipbheda, out of curiosity, what were you looking when you got to
 this idea to try to fix the code?
 >
 > @SirLouen While reviewing the code, I noticed unnecessary casting in
 this condition, nothing else.
 >
 > Here https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-
 admin/includes/ajax-actions.php#L1410

 ngl, I'm amazed, why are you simply "reviewing" the code at random,
 instead of checking some reported bug or doing some tests?

 It can feel paradoxical, but reviewing the code is a practice that is not
 recommended to be done.

 Overall, these proactive tasks (like reviewing code, sorting future
 uncertain deprecations, etc…) are a bad idea because they don't provide
 use-cases and without a use-case it's very difficult to test.

 To reach a conclusion, we have to rely single-handedly on the good
 knowledge (and very uncommon) of people like @siliconforks to consider
 many possible scenarios for such review without breaking the system

 I'm going to publish soon an article in dev blog about this topic, I will
 send it to you in Slack when it’s live.

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


More information about the wp-trac mailing list