Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
count(static::$_rules) < 0 in class Model_Crud
  • 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?
  • I've passed this on to the developer.
  • It also appear in function validates, line 685. Same Model_Crud class.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion