[GH-ISSUE #61] "Semantical error" exception when accessing certain pages as admin #50

Closed
opened 2026-02-26 09:35:26 +03:00 by kerem · 1 comment
Owner

Originally created by @ghost on GitHub (Mar 1, 2014).
Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/61

When accessing the Archives or Mailboxes view with a normal Admin account (NOT Super Admin), you will get an exception:

[Semantical Error] line 0, col 350 near 'Admin = ?1 AND': Error: Class Entities\Admin has no field or association named Admin
Development Platform Detected! Display errors enabled via application.ini. Disable in production!

0 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(483): Doctrine\ORM\Query\QueryException::semanticalError('line 0, col 350...', Object(Doctrine\ORM\Query\QueryException))

1 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(759): Doctrine\ORM\Query\Parser->semanticalError('Class Entities...', Array)

2 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(279): Doctrine\ORM\Query\Parser->processDeferredPathExpressions(Object(Doctrine\ORM\Query\AST\SelectStatement))

3 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(351): Doctrine\ORM\Query\Parser->getAST()

4 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php(266): Doctrine\ORM\Query\Parser->parse()

5 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php(278): Doctrine\ORM\Query->_parse()

6 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(967): Doctrine\ORM\Query->_doExecute()

7 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(922): Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache(NULL, 2)

8 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(738): Doctrine\ORM\AbstractQuery->execute(NULL, 2)

9 /srv/www/mailadmin/application/Repositories/Mailbox.php(65): Doctrine\ORM\AbstractQuery->getArrayResult()

10 /srv/www/mailadmin/application/controllers/MailboxController.php(138): Repositories\Mailbox->loadForMailboxList(Object(Entities\Admin), Object(Entities\Domain))

11 /srv/www/mailadmin/vendor/zendframework/zendframework1/library/Zend/Controller/Action.php(516): MailboxController->listAction()

12 /srv/www/mailadmin/vendor/zendframework/zendframework1/library/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('listAction')

13 /srv/www/mailadmin/vendor/zendframework/zendframework1/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))

14 /srv/www/mailadmin/vendor/zendframework/zendframework1/library/Zend/Application/Bootstrap/Bootstrap.php(101): Zend_Controller_Front->dispatch()

15 /srv/www/mailadmin/vendor/zendframework/zendframework1/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()

16 /srv/www/mailadmin/public/index.php(34): Zend_Application->run()

17 {main}

Looking at the referenced code usually reveals code like this:

        if( !$admin->isSuper() )
                $qb->join( 'mp.Mailbox', 'm' )
                    ->join( 'm.Domain', 'd' )
                    ->join( 'd.DomainToAdmin', 'd2a' )
                    ->where( 'd2a.Admin = ?1' )
                    ->setParameter( 1, $admin );

When comparing with views that do work with normal admin accounts, the only difference is the where clause, which is 'd2a = ?1' in views that do work, and 'd2a.Admin = ?1' in views that do throw the error. Removing the ".Admin" will fix the error. Though I am not experienced enough with the used frameworks to figure out whether or not that's safe.

Originally created by @ghost on GitHub (Mar 1, 2014). Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/61 When accessing the Archives or Mailboxes view with a normal Admin account (NOT Super Admin), you will get an exception: > [Semantical Error] line 0, col 350 near 'Admin = ?1 AND': Error: Class Entities\Admin has no field or association named Admin > Development Platform Detected! Display errors enabled via application.ini. Disable in production! > --- > # 0 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(483): Doctrine\ORM\Query\QueryException::semanticalError('line 0, col 350...', Object(Doctrine\ORM\Query\QueryException)) > # 1 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(759): Doctrine\ORM\Query\Parser->semanticalError('Class Entities...', Array) > # 2 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(279): Doctrine\ORM\Query\Parser->processDeferredPathExpressions(Object(Doctrine\ORM\Query\AST\SelectStatement)) > # 3 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(351): Doctrine\ORM\Query\Parser->getAST() > # 4 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php(266): Doctrine\ORM\Query\Parser->parse() > # 5 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php(278): Doctrine\ORM\Query->_parse() > # 6 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(967): Doctrine\ORM\Query->_doExecute() > # 7 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(922): Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache(NULL, 2) > # 8 /srv/www/mailadmin/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(738): Doctrine\ORM\AbstractQuery->execute(NULL, 2) > # 9 /srv/www/mailadmin/application/Repositories/Mailbox.php(65): Doctrine\ORM\AbstractQuery->getArrayResult() > # 10 /srv/www/mailadmin/application/controllers/MailboxController.php(138): Repositories\Mailbox->loadForMailboxList(Object(Entities\Admin), Object(Entities\Domain)) > # 11 /srv/www/mailadmin/vendor/zendframework/zendframework1/library/Zend/Controller/Action.php(516): MailboxController->listAction() > # 12 /srv/www/mailadmin/vendor/zendframework/zendframework1/library/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('listAction') > # 13 /srv/www/mailadmin/vendor/zendframework/zendframework1/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) > # 14 /srv/www/mailadmin/vendor/zendframework/zendframework1/library/Zend/Application/Bootstrap/Bootstrap.php(101): Zend_Controller_Front->dispatch() > # 15 /srv/www/mailadmin/vendor/zendframework/zendframework1/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() > # 16 /srv/www/mailadmin/public/index.php(34): Zend_Application->run() > # 17 {main} Looking at the referenced code usually reveals code like this: ``` if( !$admin->isSuper() ) $qb->join( 'mp.Mailbox', 'm' ) ->join( 'm.Domain', 'd' ) ->join( 'd.DomainToAdmin', 'd2a' ) ->where( 'd2a.Admin = ?1' ) ->setParameter( 1, $admin ); ``` When comparing with views that do work with normal admin accounts, the only difference is the where clause, which is 'd2a = ?1' in views that do work, and 'd2a.Admin = ?1' in views that do throw the error. Removing the ".Admin" will fix the error. Though I am not experienced enough with the used frameworks to figure out whether or not that's safe.
kerem closed this issue 2026-02-26 09:35:26 +03:00
Author
Owner

@barryo commented on GitHub (Mar 3, 2014):

Removing the ".Admin" will fix the error.

It would indeed.

<!-- gh-comment-id:36505935 --> @barryo commented on GitHub (Mar 3, 2014): > Removing the ".Admin" will fix the error. It would indeed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ViMbAdmin-opensolutions#50
No description provided.