You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that using an arithmetic operation inside greatest() causes parser to enter an infinite loop.
My doctrine/dbal is at version 2.12.1.
Consider this working example:
$result = $this->doctrine
->getManagerForClass(Foo::class)
->createQueryBuilder()
// Here e.g. "sqrt(30) * 100" triggers infinite loop but plain "sqrt(30)" will work just fine.
->select(' greatest( sqrt(30) * 100, sqrt(11) * 150 ) AS score')
->from(Foo::class, 'a')
->getQuery()
->getResult()
;
var_dump($result);
My understanding of the parser is limited but I managed to make this behavior stop by overriding $commonNodeMapping in Greatest.php. I have no idea what this will break in exchange...
classGreatestextendsBaseVariadicFunction
{
// Default seems to be 'StringPrimary'.protected$commonNodeMapping = 'SimpleArithmeticExpression';
protectedfunctioncustomiseFunction(): void
{
$this->setFunctionPrototype('greatest(%s)');
}
}
The text was updated successfully, but these errors were encountered:
I noticed that using an arithmetic operation inside greatest() causes parser to enter an infinite loop.
My
doctrine/dbal
is at version2.12.1
.Consider this working example:
My understanding of the parser is limited but I managed to make this behavior stop by overriding
$commonNodeMapping
inGreatest.php
. I have no idea what this will break in exchange...The text was updated successfully, but these errors were encountered: