diff --git a/application/Espo/ORM/QueryComposer/BaseQueryComposer.php b/application/Espo/ORM/QueryComposer/BaseQueryComposer.php index c5e5474189..2276a76b49 100644 --- a/application/Espo/ORM/QueryComposer/BaseQueryComposer.php +++ b/application/Espo/ORM/QueryComposer/BaseQueryComposer.php @@ -1178,7 +1178,7 @@ abstract class BaseQueryComposer implements QueryComposer $entityType = $entity->getEntityType(); - if (strpos($attribute, ':')) { + if (strpos($attribute, ':') && !Util::isArgumentString($attribute)) { /** @var int $delimiterPosition */ $delimiterPosition = strpos($attribute, ':'); $function = substr($attribute, 0, $delimiterPosition); diff --git a/tests/unit/Espo/ORM/MysqlQueryComposerTest.php b/tests/unit/Espo/ORM/MysqlQueryComposerTest.php index 1bb2be770d..5ac8b05b7e 100644 --- a/tests/unit/Espo/ORM/MysqlQueryComposerTest.php +++ b/tests/unit/Espo/ORM/MysqlQueryComposerTest.php @@ -3146,4 +3146,16 @@ class MysqlQueryComposerTest extends \PHPUnit\Framework\TestCase $this->query->composeSelect($query2) ); } + + public function testStringWithColon(): void + { + $query = SelectBuilder::create() + ->select(["'2020-10-10 20:20:20'"]) + ->from('Post') + ->build(); + + $sql = $this->query->composeSelect($query); + + $this->assertIsString($sql); + } }