Skip to content

Commit 74f531d

Browse files
committed
ACP2E-615: Elasticsearch Query breaks when we configure "int" backend type attribute and make it searchable
- Fixed the issue.
1 parent 2a774fc commit 74f531d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/code/Magento/Elasticsearch/SearchAdapter/Query/ValueTransformer/IntegerTransformer.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class IntegerTransformer implements ValueTransformerInterface
1919
*/
2020
public function transform(string $value): ?int
2121
{
22-
return \is_numeric($value) ? (int) $value : null;
22+
return (\is_numeric($value) &&
23+
$this->validateIntegerTypesWithInRange($value)) ? (int) $value : null;
24+
}
25+
26+
/**
27+
* @param $value
28+
* @return bool
29+
*/
30+
public function validateIntegerTypesWithInRange($value): bool
31+
{
32+
return (abs($value) & 0x7FFFFFFF) === abs($value);
2333
}
2434
}

0 commit comments

Comments
 (0)