bcit-ci/CodeIgniter · error · InvalidArgumentException

%s() expects $key to be a non-empty string

Error message

%s() expects $key to be a non-empty string

What it means

Error "%s() expects $key to be a non-empty string" thrown in bcit-ci/CodeIgniter.

Source

Thrown at system/database/DB_query_builder.php:880

	 * @used-by	or_having_in()
	 * @used-by	having_not_in()
	 * @used-by	or_having_not_in()
	 *
	 * @param	string	$qb_key	'qb_where' or 'qb_having'
	 * @param	string	$key	The field to search
	 * @param	array	$values	The values searched on
	 * @param	bool	$not	If the statement would be IN or NOT IN
	 * @param	string	$type
	 * @param	bool	$escape
	 * @return	CI_DB_query_builder
	 */
	protected function _wh_in($qb_key, $key, array $values, $not = FALSE, $type = 'AND ', $escape = NULL)
	{
		$qb_cache_key = ($qb_key === 'qb_having') ? 'qb_cache_having' : 'qb_cache_where';

		if (empty($key) OR ! is_string($key))
		{
			throw new InvalidArgumentException(sprintf('%s() expects $key to be a non-empty string', debug_backtrace(0, 2)[1]['function']));
		}

		if (empty($values))
		{
			throw new InvalidArgumentException(sprintf('%s() expects $values to be a non-empty array', debug_backtrace(0, 2)[1]['function']));
		}

		is_bool($escape) OR $escape = $this->_protect_identifiers;

		$not = ($not) ? ' NOT' : '';

		if ($escape === TRUE)
		{
			$wh_in = array();
			foreach ($values as $value)
			{
				$wh_in[] = $this->escape($value);
			}

View on GitHub (pinned to 3658d731ea)

When it happens

Trigger: Thrown at system/database/DB_query_builder.php:880 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/cb036b49454f215e. Report an issue: GitHub.