Hi
the instructions for the limit input fields read as follow:

If limit is negative, all components except the last -limit are returned.

in the validator though, the limit is checked with a ctype_digit function but, as i found out returns true only for positive string numbers

ctype_digit("-1"); //false

Comments

twistor’s picture

Assigned: Unassigned » twistor
Status: Active » Fixed
twistor’s picture

gionnibgud’s picture

I'm not reopening the issue but I'm not sure is_numeric is a good solution. As I found out from the php manual "+0123.45e6 is a valid numeric value" but I don't think explode would accept that as a parameter.

What about checking for negative value before ctype_digit? Would this work?

if (!empty($settings['limit']) &&  !($settings['limit'] < 0) && !ctype_digit($settings['limit'])) {
     form_set_error('settings][limit', t('Limit must be an integer or blank.'));
   }

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.