?
avatar tgv604
tgv604
28 May 2015

Steps to reproduce the issue

Create a contact, public & published, save, memorise id (1).
Create another contact, public & unpublished, save, memorise id (2).
Create another contact, registered & published, save, memorise id (3).
Create a menu item "list contacts in category", call it "contacts".
Navigate to http://mysite.com/contacts to see the list of contacts as public, you'll see just one contact (1).

Navigate to this contact (http://mysite.com/contacts/1-somename), all good.

Navigate to unpublished contact (http://mysite.com/contacts/2-somename), see 404 "Contact not found" error page. All good.

Navigate to registered contact (http://mysite.com/contacts/3-somename), see long error message with stack trace.

Expected result

404 or 403 Error page (error template based) saying "contact not found" or "not authorised"

Actual result

Normal page (not error template based) with just an error message:

Error

exception 'Exception' with message 'Contact not found' in C:\home\bgpa\j31\components\com_contact\models\contact.php:328 Stack trace: #0 C:\home\bgpa\j31\components\com_contact\models\contact.php(252): ContactModelContact->getContactQuery(28) #1 C:\home\bgpa\j31\libraries\legacy\view\legacy.php(401): ContactModelContact->getItem() #2 C:\home\bgpa\j31\components\com_contact\views\contact\view.html.php(66): JViewLegacy->get('Item') #3 C:\home\bgpa\j31\libraries\legacy\controller\legacy.php(690): ContactViewContact->display() #4 C:\home\bgpa\j31\components\com_contact\controller.php(42): JControllerLegacy->display(true, Array) #5 C:\home\bgpa\j31\libraries\legacy\controller\legacy.php(728): ContactController->display() #6 C:\home\bgpa\j31\components\com_contact\contact.php(15): JControllerLegacy->execute(NULL) #7 C:\home\bgpa\j31\libraries\cms\component\helper.php(391): require_once('C:\home\bgpa\j3...') #8 C:\home\bgpa\j31\libraries\cms\component\helper.php(371): JComponentHelper::executeComponent('C:\home\bgpa\j3...') #9 C:\home\bgpa\j31\libraries\cms\application\site.php(191): JComponentHelper::renderComponent('com_contact') #10 C:\home\bgpa\j31\libraries\cms\application\site.php(230): JApplicationSite->dispatch() #11 C:\home\bgpa\j31\libraries\cms\application\cms.php(252): JApplicationSite->doExecute() #12 C:\home\bgpa\j31\index.php(40): JApplicationCms->execute() #13 {main}

System information (as much as possible)

J3.4.1, SEF on, error reporting off (!!!)

Additional comments

Probably a clash of old and new ways of raising errors (JError vs Exception) in contact model.

adding this line in components/com_contact/models/contact.php @ line 257 fixes the situation:

else JError::raiseError(404, JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND'));

avatar joomla-cms-bot joomla-cms-bot - change - 28 May 2015
Labels Added: ?
avatar tgv604 tgv604 - open - 28 May 2015
avatar tgv604 tgv604 - change - 28 May 2015
Build 3.4.1 staging
avatar BuddhiEash
BuddhiEash - comment - 1 Jun 2015

I can confirm this issue.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7053.

avatar zero-24 zero-24 - change - 1 Jun 2015
Status New Confirmed
avatar brianteeman
brianteeman - comment - 17 Jun 2015

Confirmed

avatar Bakual
Bakual - comment - 17 Jun 2015

@tgv604 Since you already proposed a fix, can you create a Pull Request for it? Have a look at https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests how it works.

avatar jlainezs jlainezs - reference | 637d8c0 - 12 Sep 15
avatar jlainezs
jlainezs - comment - 12 Sep 2015

I've sent a PR for this issue.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7053.

avatar jlainezs jlainezs - reference | 2f4cede - 12 Sep 15
avatar jlainezs jlainezs - reference | f0ddbb0 - 12 Sep 15
avatar jlainezs jlainezs - reference | fead8bb - 12 Sep 15
avatar zero-24 zero-24 - close - 13 Sep 2015
avatar zero-24 zero-24 - change - 13 Sep 2015
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2015-09-13 06:35:42
Closed_By zero-24
avatar zero-24 zero-24 - close - 13 Sep 2015
avatar zero-24
zero-24 - comment - 13 Sep 2015

Closing as we have a PR by @jlainezs Thanks.

avatar jlainezs jlainezs - reference | ae35f11 - 13 Sep 15
avatar jlainezs jlainezs - reference | f2f19e9 - 13 Sep 15
avatar zero-24
zero-24 - comment - 15 Sep 2015

For reference PR is: #7867

Add a Comment

Login with GitHub to post a comment