Min Items validation fails on empty array

OS info

  • Operating System : Windows 10.0.22631
  • Wappler Version : 7.0.1
  • PHP

Problem description

Empty array always return true on Min Items validation due to $length == 0 test and skipping the 2nd test for the entered value.

    public function minitems($value, $param) {
        $length = $this->getLength($value);
        return $length == 0 || (is_array($value) && $length >= (int)$param);
    }

Steps to reproduce

  1. Create an empty array.
  2. Add Validate Data step.
  3. Add Min Items validation with a value of 1.
  4. Validation should fail but passes.