[geeklog-devel] COM_applyFilter doesn't accept negative numbers

Vincent Furia vfuria at gmail.com
Fri Feb 18 11:04:28 EST 2005


If you call COM_applyFilter($var, true) you run into a problem if $var
is negative.  In that case COM_applyFiler will return 0.

It comes down to this:
    if( $isnumeric )
    {
        // Note: PHP's is_numeric() accepts values like 4e4 as numeric
        if( !is_numeric( $p ) || ( preg_match( '/^([0-9]+)$/', $p ) == 0 ))
        {
            $p = 0;
        }
    }

Notice the preg_match won't match negative numbers.  This is easily
fixed, but I'm not quite sure why is_numeric by itself isn't
sufficient.  Is there any problem if we allow numbers like 4e4 to be
accepted?

I found this because it is breaking the ability to change comment
display modes in pollbooth.php.

-Vinny

P.S.  Note that I have NOT checked in any fixes for this.



More information about the geeklog-devel mailing list