Skip to content

Commit 717e917

Browse files
authored
Ensuring we only throw Exception in CI_DEBUG
We should throw an exception when the wrong type of variable is passed into _whereIn however we should only do this in debug mode.
1 parent 17dd2e3 commit 717e917

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

system/Database/BaseBuilder.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,12 +987,22 @@ protected function _whereIn(string $key = null, $values = null, bool $not = fals
987987
{
988988
if (empty($key) || ! is_string($key))
989989
{
990-
throw new InvalidArgumentException(sprintf('%s() expects $key to be a non-empty string', debug_backtrace(0, 2)[1]['function']));
990+
if (CI_DEBUG)
991+
{
992+
throw new InvalidArgumentException(sprintf('%s() expects $key to be a non-empty string', debug_backtrace(0, 2)[1]['function']));
993+
}
994+
995+
return this;
991996
}
992997

993998
if ($values === null || (! is_array($values) && ! ($values instanceof Closure)))
994999
{
995-
throw new InvalidArgumentException(sprintf('%s() expects $values to be of type array or closure', debug_backtrace(0, 2)[1]['function']));
1000+
if (CI_DEBUG)
1001+
{
1002+
throw new InvalidArgumentException(sprintf('%s() expects $values to be of type array or closure', debug_backtrace(0, 2)[1]['function']));
1003+
}
1004+
1005+
return this;
9961006
}
9971007

9981008
is_bool($escape) || $escape = $this->db->protectIdentifiers;

0 commit comments

Comments
 (0)