DDC-794: Error: Expected Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS, got '=' #978

Closed
opened 2026-01-22 12:57:54 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Sep 8, 2010).

Jira issue originally created by user pabelanger:

This apears to be a regression, using the following syntax:

Doctrine - works!

$dbSelect = Doctrine_Query::create($this->getConnection())
    ->from($this->_tableName)
    ->select('*, ('.$this->*credentialColumn.' = '.str_replace('?',  $this->getConnection()->quote($this->_credential), $this->_credentialTreatment).') AS zend_auth_credential*match')
    ->addWhere($this->*identityColumn .' = ?', $this->*identity);

Doctrine2 - exception

$dbSelect = $this->getConnection()->createQueryBuilder()
    ->select('e.*, (' . $this->*credentialColumn . ' = ' . str_replace('?', '"' . $this->_credential . '"', $this->_credentialTreatment) . ') AS zend_auth_credential*match')
    ->from($this->_tableName, 'e')
    ->where('e.' . $this->_identityColumn . ' = ?1')
    ->setParameter(1, $this->_identity);
SELECT e.*, (password = SHA1("changeme")) AS zend*auth_credential_match FROM Application_Model*Users e WHERE e.username = ?1

Exception

Message: [Syntax Error] line 0, col 22: Error: Expected Doctrine\ORM\Query\Lexer::T*CLOSE*PARENTHESIS, got '='
Originally created by @doctrinebot on GitHub (Sep 8, 2010). Jira issue originally created by user pabelanger: This apears to be a regression, using the following syntax: Doctrine - works! ``` $dbSelect = Doctrine_Query::create($this->getConnection()) ->from($this->_tableName) ->select('*, ('.$this->*credentialColumn.' = '.str_replace('?', $this->getConnection()->quote($this->_credential), $this->_credentialTreatment).') AS zend_auth_credential*match') ->addWhere($this->*identityColumn .' = ?', $this->*identity); ``` Doctrine2 - exception ``` $dbSelect = $this->getConnection()->createQueryBuilder() ->select('e.*, (' . $this->*credentialColumn . ' = ' . str_replace('?', '"' . $this->_credential . '"', $this->_credentialTreatment) . ') AS zend_auth_credential*match') ->from($this->_tableName, 'e') ->where('e.' . $this->_identityColumn . ' = ?1') ->setParameter(1, $this->_identity); ``` ``` SELECT e.*, (password = SHA1("changeme")) AS zend*auth_credential_match FROM Application_Model*Users e WHERE e.username = ?1 ``` Exception ``` Message: [Syntax Error] line 0, col 22: Error: Expected Doctrine\ORM\Query\Lexer::T*CLOSE*PARENTHESIS, got '=' ```
admin added the Bug label 2026-01-22 12:57:54 +01:00
admin closed this issue 2026-01-22 12:57:56 +01:00
Author
Owner

@doctrinebot commented on GitHub (Sep 9, 2010):

Comment created by @beberlei:

Fixed formatting

@doctrinebot commented on GitHub (Sep 9, 2010): Comment created by @beberlei: Fixed formatting
Author
Owner

@doctrinebot commented on GitHub (Sep 9, 2010):

Comment created by @beberlei:

Sha1 is not a supported function of DQL, you have to implement it yourself:

http://www.doctrine-project.org/projects/orm/2.0/docs/reference/dql-doctrine-query-language/en#functions,-operators,-aggregates:adding-your-own-functions-to-the-dql-language

Additionally you cannot use the equals operator inside the select expression, its not cross-vendor compatible, therefore not supported anymore. You can easily rewrite the query
to only return the password and do the sha1 in userland, that way its even cross-vendor compatible, since that function is not supported by vendors except MySQL i think.

@doctrinebot commented on GitHub (Sep 9, 2010): Comment created by @beberlei: Sha1 is not a supported function of DQL, you have to implement it yourself: http://www.doctrine-project.org/projects/orm/2.0/docs/reference/dql-doctrine-query-language/en#functions,-operators,-aggregates:adding-your-own-functions-to-the-dql-language Additionally you cannot use the equals operator inside the select expression, its not cross-vendor compatible, therefore not supported anymore. You can easily rewrite the query to only return the password and do the sha1 in userland, that way its even cross-vendor compatible, since that function is not supported by vendors except MySQL i think.
Author
Owner

@doctrinebot commented on GitHub (Sep 9, 2010):

Issue was closed with resolution "Won't Fix"

@doctrinebot commented on GitHub (Sep 9, 2010): Issue was closed with resolution "Won't Fix"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#978