[wp-trac] [WordPress Trac] #63975: wp_delete_auto_drafts passes post ID as string instead of as int
WordPress Trac
noreply at wordpress.org
Tue Sep 16 08:37:39 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: Awaiting Review
Component: Posts, Post Types | Version: 3.4
Severity: trivial | Resolution:
Keywords: has-patch changes-requested | Focuses:
-----------------------------------------+------------------------------
Comment (by kkmuffme):
Replying to [comment:2 SirLouen]:
> `$old_posts` receives an array of post ID, which, according to the
database table definition, have to be `int` (BIGINT) forcefully. So strong
typing is good for quality purposes, but code is plagued with these.
This is wrong. INT (or BIGINT) is always a (numeric-)string when using
mysql in PHP on unix.
Replying to [comment:7 westonruter]:
> Is casting to an `int` correct? When it is a string, what value does it
have? If it isn't an `int` then it should just be skipped rather than
attempting to delete a post with the ID of `0`.
Yes, bc this is how mysql drivers in PHP work. By (mysql table) definition
it can only be a numeric string.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63975#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list