Skip to content

Commit d4f01e8

Browse files
committed
Cast result from ExpressionLanguage eval to bool
1 parent 72a9dfa commit d4f01e8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Provider/Indexable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function isObjectIndexable($indexName, $typeName, $object)
8282
}
8383

8484
if ($callback instanceof Expression) {
85-
return $this->getExpressionLanguage()->evaluate($callback, array(
85+
return (bool) $this->getExpressionLanguage()->evaluate($callback, array(
8686
'object' => $object,
8787
$this->getExpressionVar($object) => $object,
8888
));

Tests/Provider/IndexableTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public function provideIsIndexableCallbacks()
7373
array('entity.maybeIndex()', true),
7474
array('!object.isIndexable() && entity.property == "abc"', true),
7575
array('entity.property != "abc"', false),
76+
array('["array", "values"]', true),
77+
array('[]', false)
7678
);
7779
}
7880

0 commit comments

Comments
 (0)