[wp-trac] [WordPress Trac] #58988: Coding Standards: Use strict comparison in wp-admin/includes/ajax-actions.php

WordPress Trac noreply at wordpress.org
Mon Aug 7 10:14:09 UTC 2023


#58988: Coding Standards: Use strict comparison in wp-admin/includes/ajax-
actions.php
-------------------------+-------------------------------
 Reporter:  mujuonly     |       Owner:  (none)
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  General      |     Version:
 Severity:  normal       |  Resolution:  duplicate
 Keywords:               |     Focuses:  coding-standards
-------------------------+-------------------------------

Comment (by SergeyBiryukov):

 Thanks for the ticket and the patch! As noted above, a PR on the other
 ticket should already cover this.

 Some of these changes would need double-checking, as the values passed in
 `$_GET` or `$_POST` arrays are strings, so for example `1 ===
 $_GET['test']` or `1 === $_POST['delete']` might not work as expected.

 Some other values are converted to an integer, so this would need an
 appropriate type adjustment as well:
 {{{
 $thumbnail_id = (int) $_POST['thumbnail_id'];
 ...
 if ( '-1' === $thumbnail_id ) { ... }
 }}}

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


More information about the wp-trac mailing list