Skip to content
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

Allow bigint in search #6338

Open
wants to merge 1 commit into
base: 4.x
Choose a base branch
from

Conversation

simoheinonen
Copy link
Contributor

If the query is integer but not between these values the query will end up a where clause without any conditions so doctrine fails:

Uncaught PHP Exception Doctrine\ORM\Query\QueryException: "[Syntax Error] line 0, col -1: Error: Expected Literal, got end of string." at QueryException.php line 34

@@ -88,7 +88,7 @@ private function addSearchClause(QueryBuilder $queryBuilder, SearchDto $searchDt
$lowercaseQueryTerm = mb_strtolower($queryTerm);
$isNumericQueryTerm = is_numeric($queryTerm);
$isSmallIntegerQueryTerm = ctype_digit($queryTerm) && $queryTerm >= -32768 && $queryTerm <= 32767;
$isIntegerQueryTerm = ctype_digit($queryTerm) && $queryTerm >= -2147483648 && $queryTerm <= 2147483647;
$isIntegerQueryTerm = ctype_digit($queryTerm) && $queryTerm >= -9223372036854775808 && $queryTerm <= 18446744073709551617;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$isIntegerQueryTerm = ctype_digit($queryTerm) && $queryTerm >= -9223372036854775808 && $queryTerm <= 18446744073709551617;
$isIntegerQueryTerm = ctype_digit($queryTerm) && $queryTerm >= \PHP_INT_MIN && $queryTerm <= \PHP_INT_MAX;

Copy link
Contributor

@Seb33300 Seb33300 Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably not the correct way to fix it.
I think you need to create a new condition specific for big int here:
https://github.com/simoheinonen/EasyAdminBundle/blob/6248349de0e108640b78bef70656db6f35f7386c/src/Orm/EntityRepository.php#L290-L292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants