bcit-ci/CodeIgniter · error · RuntimeException

Form_validation: set_rules() called with an empty $rules par

Error message

Form_validation: set_rules() called with an empty $rules parameter

What it means

Error "Form_validation: set_rules() called with an empty $rules parameter" thrown in bcit-ci/CodeIgniter.

Source

Thrown at system/libraries/Form_validation.php:202

				// Add the custom error message array
				$errors = (isset($row['errors']) && is_array($row['errors'])) ? $row['errors'] : array();

				// Here we go!
				$this->set_rules($row['field'], $label, $row['rules'], $errors);
			}

			return $this;
		}
		elseif ( ! isset($rules))
		{
			throw new BadMethodCallException('Form_validation: set_rules() called without a $rules parameter');
		}

		// No fields or no rules? Nothing to do...
		if ( ! is_string($field) OR $field === '' OR empty($rules))
		{
			throw new RuntimeException('Form_validation: set_rules() called with an empty $rules parameter');
		}
		elseif ( ! is_array($rules))
		{
			// BC: Convert pipe-separated rules string to an array
			if ( ! is_string($rules))
			{
				throw new InvalidArgumentException('Form_validation: set_rules() expect $rules to be string or array; '.gettype($rules).' given');
			}

			$rules = preg_split('/\|(?![^\[]*\])/', $rules);
		}

		// If the field label wasn't passed we use the field name
		$label = ($label === '') ? $field : $label;

		$indexes = array();

		// Is the field name an array? If it is an array, we break it apart

View on GitHub (pinned to 3658d731ea)

When it happens

Trigger: Thrown at system/libraries/Form_validation.php:202 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bcit-ci/CodeIgniter@3658d731ea (2026-08-17). Data as JSON: /api/errors/d4da3cbc6dfc4df2. Report an issue: GitHub.