(Retrofit from trunk) N°1444 : fixed regression introduced in [r5725] & [r5774]

SVN:2.4[5810]
This commit is contained in:
Stephen Abello
2018-05-23 11:29:56 +00:00
parent f96902c03e
commit 880faf2021
2 changed files with 8 additions and 2 deletions

View File

@@ -501,7 +501,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

@@ -226,6 +226,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;
@@ -692,7 +696,7 @@ class VariableExpression extends UnaryExpression
$res = CMDBSource::Quote($aArgs[$this->m_sName]);
if (is_array($res))
{
$res = '('.implode(', ', $res).')';
$res = implode(', ', $res);
}
return $res;
}