[wp-trac] [WordPress Trac] #63975: wp_delete_auto_drafts passes post ID as string instead of as int

WordPress Trac noreply at wordpress.org
Thu Sep 18 21:55:33 UTC 2025


#63975: wp_delete_auto_drafts passes post ID as string instead of as int
-------------------------------------------------+-------------------------
 Reporter:  kkmuffme                             |       Owner:  kkmuffme
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Posts, Post Types                    |     Version:  3.4
 Severity:  trivial                              |  Resolution:
 Keywords:  has-patch changes-requested has-     |     Focuses:
  test-info                                      |
-------------------------------------------------+-------------------------
Changes (by SirLouen):

 * keywords:  has-patch changes-requested => has-patch changes-requested
     has-test-info
 * milestone:  Awaiting Review => Future Release


Comment:

 Replying to [comment:23 westonruter]:
 > I support this change to ensure that `$post_id` gets programmatically
 coerced to `int` at the top of `wp_delete_post()`, if you want to prepare
 a patch.

 I was ranting in my head, thinking, "''If we do this to this function,
 then we have to do this with many functions, lets try to show an
 example''". And I did a search in `post.php` for any other function with
 an action hook, and got to `stick_post` and here is what I found:
 https://github.com/SirLouen/wordpress-
 develop/blob/d769c6608dbe3ed56478df6b9f8c4fe063fe25f0/src/wp-
 includes/post.php#L3303

 It seems, that @SergeyBiryukov (who else could have been?,
 [https://core.trac.wordpress.org/ticket/63975?replyto=23#comment:6 as I
 said], he is ultimately the king of these things), in [47557], [47550]
 already had this same idea (but forgot some functions like this one) to
 solve `WordPress.PHP.StrictInArray.MissingTrueStrict`

 > But the issue here are actions not filters

 Nah, I just used these as an example because I wanted to illustrate that
 there are actually some proposals towards better typing (despite that WP
 has been almost completely typeless), and this was the most similar
 example I could find. He seemed angry because we were ignoring another
 typing request, and I would rather not imply that it was something
 personal. So I wanted to leave this clear with such a (weak) example. :)

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


More information about the wp-trac mailing list