Not sure if I'm missing something here but is this method complete?

I'm trying to validate the size of some input to be between 5 and 15 characters and even though outputting the raw data shows that the field satisfies this condition I still get a false response.

I checked the testBetween method and it is as follows:

public function testBetween($key, $min, $max, $inc = TRUE)
    {
        if (!$this->keyExists($key)) {
            return false;
        }
        if (Zend_Filter::isBetween($this->_source[$key], $min, $max, $inc)) {
            return $this->_source[$key];
        }

        return FALSE;
    }
The isBetween method is as follows:
public static function isBetween($value, $min, $max, $inc = TRUE)
    {
        if ($value > $min &&
            $value < $max) {
            return TRUE;
        }

        if ($value >= $min &&
            $value <= $max &&
            $inc) {
            return TRUE;
        }

        return FALSE;
    }
Shouldn't there be a call to strlen() somewhere? Because otherwise if the value is say 'myusername' and the min and max are 5 and 15 respectively it's checking if 'myusername' is >= 5 and <=15.

when i change the following line:
        if (Zend_Filter::isBetween($this->_source[$key], $min, $max, $inc)) {

to
        if (Zend_Filter::isBetween(strlen($this->_source[$key]), $min, $max, $inc)) {
I get the expected response that I'm looking for.

Is this an issue or is my interpretation of what this method is suppose to wrong?
--
Jeff Busby
[EMAIL PROTECTED]

Tenbelowzero, Inc.
Empowering Business to Harness the Power of Content

323 Kerr Street, Suite 203, Oakville, ON L6K 3B6
tel: 905.337.0657  fax: 905.337.1479   http://www.tenbelowzero.com


begin:vcard
fn:Jeff Busby
n:Busby;Jeff
org:Tenbelowero Inc
adr:Suite 203;;323 Kerr St;Oakville;Ont;L6K3B6;Canada
email;internet:[EMAIL PROTECTED]
title:CTO
tel;work:905.337.0657
tel;fax:905.337.1479
tel;cell:905.407.4359
x-mozilla-html:FALSE
url:http://www.tenbelowzero.com
version:2.1
end:vcard

Reply via email to