-
-
Notifications
You must be signed in to change notification settings - Fork 56
fix: avoid infinite parsing loop for GREATEST() and LEAST() by using SimpleArithmeticExpression
#338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ing `SimpleArithmeticExpression`
WalkthroughThis pull request updates the mapping configuration and test expectations. The Changes
Possibly related PRs
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/LeastTest.php (1)
37-41: Well-structured DQL test casesThese DQL statements effectively test the same scenarios as the SQL statements: multiple columns, column with expression, and multiple expressions. This provides good coverage for the fix implemented in BaseComparisonFunction.
Consider adding a test case with different data types, as PostgreSQL's LEAST function can handle comparisons across compatible types (e.g., integers and floats). This would further align with PostgreSQL's documentation.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/GreatestTest.php (1)
37-41: Well-structured DQL test casesThese DQL statements effectively test the same scenarios as the SQL statements: multiple columns, column with expression, and multiple expressions. This provides good coverage for the fix implemented in BaseComparisonFunction.
Consider adding a test case with different data types, as PostgreSQL's GREATEST function can handle comparisons across compatible types (e.g., integers and floats). This would further align with PostgreSQL's documentation.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseComparisonFunction.php(1 hunks)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/GreatestTest.php(1 hunks)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/LeastTest.php(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/**/*.php`: Use the PostgreSQL official documentation to verify that tests include comprehensive use cases and example SQL que...
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/**/*.php: Use the PostgreSQL official documentation to verify that tests include comprehensive use cases and example SQL queries for the tested SQL functions and operators.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/LeastTest.phptests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/GreatestTest.php
🧬 Code Graph Analysis (2)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/LeastTest.php (2)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/GreatestTest.php (1)
getDqlStatements(35-42)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1)
getDqlStatements(92-92)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/GreatestTest.php (3)
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/LeastTest.php (1)
getDqlStatements(35-42)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCatTest.php (1)
getDqlStatements(27-33)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (1)
getDqlStatements(92-92)
⏰ Context from checks skipped due to timeout of 90000ms (20)
- GitHub Check: PHP 8.4 + Doctrine ORM 3.0 + Doctrine Lexer latest
- GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer 3.0
- GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer latest
- GitHub Check: PHP 8.4 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
- GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
- GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer latest
- GitHub Check: PHP 8.3 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
- GitHub Check: PHP 8.3 + Doctrine ORM 2.14 + Doctrine Lexer latest
- GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer latest
- GitHub Check: PHP 8.3 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
- GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer 2.1
- GitHub Check: PHP 8.2 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
- GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer 3.0
- GitHub Check: PHP 8.2 + Doctrine ORM 2.14 + Doctrine Lexer latest
- GitHub Check: PHP 8.3 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
- GitHub Check: PHP 8.2 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
- GitHub Check: PHP 8.2 + Doctrine ORM 2.14 + Doctrine Lexer 2.1
- GitHub Check: PHP 8.1 + Doctrine ORM latest + Doctrine Lexer 3.0
- GitHub Check: PHP 8.1 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
- GitHub Check: sloth
🔇 Additional comments (3)
src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseComparisonFunction.php (1)
14-14: Appropriate mapping change to prevent infinite parsing loopChanging from 'ArithmeticPrimary' to 'SimpleArithmeticExpression' is a good choice to avoid the infinite parsing loop mentioned in the PR title. This new mapping should properly handle both simple values and expressions within GREATEST() and LEAST() functions without triggering recursion issues in the parser.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/LeastTest.php (1)
28-32: Good test expansion with comprehensive scenariosThe updated test cases properly cover multiple scenarios for the LEAST function, including column references and expressions. This aligns with the PR's goal of fixing parsing issues and matches PostgreSQL's documentation on the LEAST function.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/GreatestTest.php (1)
28-32: Good test expansion with comprehensive scenariosThe updated test cases properly cover multiple scenarios for the GREATEST function, including column references and expressions. This aligns with the PR's goal of fixing parsing issues and matches PostgreSQL's documentation on the GREATEST function.
…ing `SimpleArithmeticExpression` (#338)
GREATEST() and LEAST() by using SimpleArithmeticExpressionGREATEST() and LEAST() by using SimpleArithmeticExpression
…
Summary by CodeRabbit
Refactor
Tests