N°5791 - Obsolescence condition containing IN makes object creation fail

This commit is contained in:
Eric Espie
2025-01-07 11:29:33 +01:00
parent 6948c594c2
commit 346a8eadec
2 changed files with 16 additions and 2 deletions

View File

@@ -575,6 +575,9 @@ class BinaryExpression extends Expression
case 'LIKE':
$sType = 'like';
break;
case 'IN':
$sType = 'in';
break;
default:
throw new Exception("Operator '$sOperator' not yet supported");
}
@@ -641,6 +644,9 @@ class BinaryExpression extends Expression
$sEscaped = str_replace(array('%', '_', '\\\\.*', '\\\\.'), array('.*', '.', '%', '_'), $sEscaped);
$result = (int) preg_match("/$sEscaped/i", $mLeft);
break;
case 'in':
$result = in_array($mLeft, $mRight);
break;
}
return $result;
}
@@ -2250,7 +2256,12 @@ class ListExpression extends Expression
*/
public function Evaluate(array $aArgs)
{
throw new Exception('list expression not yet supported');
//throw new Exception('list expression not yet supported');
$aResult = [];
foreach ($this->m_aExpressions as $oExpressions) {
$aResult[] = $oExpressions->Evaluate($aArgs);
}
return $aResult;
}
/**