I found this line of code in class Model_Crud, protected function run_validation:
//Line: 707
if ( ! isset(static::$_rules) or count(static::$_rules) < 0)
{
return true;
}
According to PHP Manual: http://www.php.net/manual/en/function.count.php
The return values for function count:
- Returns the number of elements in var. If var is not an array or an object with implemented Countable interface, 1 will be returned. There is one exception, if var is NULL, 0 will be returned.
The count function never return value less than 0.
So, if the static::$_rules is set, then the count(static::$_rules) < 0 will always return false because (the smallest number) 0 < 0 is false.
Then why compare the count(static::$_rules) < 0 ? Is this a bug?