[wp-trac] [WordPress Trac] #4762: new function: absint()
WordPress Trac
wp-trac at lists.automattic.com
Thu Aug 16 19:58:21 GMT 2007
#4762: new function: absint()
----------------------------+-----------------------------------------------
Reporter: markjaquith | Owner: anonymous
Type: task | Status: new
Priority: normal | Milestone: 2.4 (future)
Component: Administration | Version: 2.3
Severity: normal | Keywords:
----------------------------+-----------------------------------------------
There were a few bugs whereby things were being cast to ints and providing
a negative int would mess up a query (for instance, with SQL LIMITs). We
accept negative ints for post IDs (temporarily), but in all other places
that Matt or I could think of, we use positive integers.
{{{
function absint($string) {
return abs(intval($string));
}
}}}
We'd then convert all instances of {{{intval()}}} or {{{(int)}}} casting
to use {{{absint()}}} (minus post IDs).
Objections? Thoughts?
--
Ticket URL: <http://trac.wordpress.org/ticket/4762>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list