N°1444 : fixed regression introduced in [r5724] & [r5773]

SVN:trunk[5809]
This commit is contained in:
Stephen Abello
2018-05-23 10:11:23 +00:00
parent 4f900e36c1
commit 0a44f34c2c
2 changed files with 8 additions and 2 deletions

View File

@@ -508,7 +508,9 @@ class DBObjectSearch extends DBSearch
$oParamExpression = new VariableExpression($sInParamName);
$this->SetInternalParams(array($sInParamName => $aValues));
$oInCondition = new BinaryExpression($oFieldExpression, $sOperator, $oParamExpression);
$oListExpression = new ListExpression(array($oParamExpression));
$oInCondition = new BinaryExpression($oFieldExpression, $sOperator, $oListExpression);
$this->AddConditionExpression($oInCondition);
}

View File

@@ -303,6 +303,10 @@ class BinaryExpression extends Expression
{
throw new CoreException('Expecting an Expression object on the right hand', array('found_class' => get_class($oRightExpr)));
}
if ( (($sOperator == "IN") || ($sOperator == "NOT IN")) && !$oRightExpr instanceof ListExpression)
{
throw new CoreException("Expecting a List Expression object on the right hand for operator $sOperator", array('found_class' => get_class($oRightExpr)));
}
$this->m_oLeftExpr = $oLeftExpr;
$this->m_oRightExpr = $oRightExpr;
$this->m_sOperator = $sOperator;
@@ -1286,7 +1290,7 @@ class VariableExpression extends UnaryExpression
$res = CMDBSource::Quote($aArgs[$this->m_sName]);
if (is_array($res))
{
$res = '('.implode(', ', $res).')';
$res = implode(', ', $res);
}
return $res;
}