[wp-trac] [WordPress Trac] #41944: Add %u support to wpdb->prepare
WordPress Trac
noreply at wordpress.org
Thu Sep 21 13:54:20 UTC 2017
#41944: Add %u support to wpdb->prepare
--------------------------+------------------------------
Reporter: charlestonsw | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 4.8.2
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by charlestonsw):
That may be true, but how does sprintf work in PHP? They document it as
though %d and %u are NOT the same.
http://php.net/manual/en/function.sprintf.php
d - the argument is treated as an integer, and presented as a (signed)
decimal number.
u - the argument is treated as an integer, and presented as an unsigned
decimal number.
And since there are many instances where you are looking up a KEY which
can be a MySQL unsigned int doing a select * where key=%u seems prudent.
Unless someone can confirm that PHP sprintf engine allows %d to render a
full unsigned int. I'm not familiar with the internal workings of PHP
but the public docs indicate %d and %u are different.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41944#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list