Create a contact.
Create a single Contact menu item to display this contact.
Modify the Contact Publishing parameters.
For example:
Set it to Unpublished
Or, set it to Published and modify publish up or down so as to not display the contact when the menu item is clicked to therefore obtain a 404.
404 Contact not found
Argument 1 passed to Joomla\Registry\Registry::merge() must be an instance of Joomla\Registry\Registry, null given, called in /Applications/MAMP/htdocs/newfolder/joomla40/components/com_contact/src/Model/ContactModel.php on line 132
Modifying ContactModel.php
line 132 to use registry
From
$temp->merge($contact->params);
$contact->params = $temp;
to
$registry = new Registry($contact->params);
$temp->merge($registry);
$contact->params = $temp;
We now get
Argument 1 passed to Joomla\Registry\Registry::merge() must be an instance of Joomla\Registry\Registry, null given, called in /Applications/MAMP/htdocs/newfolder/joomla40/components/com_contact/src/View/Contact/HtmlView.php on line 147
Modifying Contact/HtmlView.php
Adding use Joomla\Registry\Registry;
Then change line 147 from
$temp->merge($item->params);
$item->params = $temp;
to
$registry = new Registry($item->params);
$temp->merge($registry);
$item->params = $temp;
Result:
500 Exception: Contact not found in /Applications/MAMP/htdocs/newfolder/joomla40/components/com_contact/src/Model/ContactModel.php:249 Stack trace: #0 /Applications/MAMP/htdocs/newfolder/joomla40/libraries/src/MVC/View/AbstractView.php(146): Joomla\Component\Contact\Site\Model\ContactModel->getItem() #1 /Applications/MAMP/htdocs/newfolder/joomla40/components/com_contact/src/View/Contact/HtmlView.php(118): Joomla\CMS\MVC\View\AbstractView->get('Item') #2 /Applications/MAMP/htdocs/newfolder/joomla40/libraries/src/MVC/Controller/BaseController.php(691): Joomla\Component\Contact\Site\View\Contact\HtmlView->display() #3 /Applications/MAMP/htdocs/newfolder/joomla40/components/com_contact/src/Controller/DisplayController.php(81): Joomla\CMS\MVC\Controller\BaseController->display(false, Array) #4 /Applications/MAMP/htdocs/newfolder/joomla40/libraries/src/MVC/Controller/BaseController.php(729): Joomla\Component\Contact\Site\Controller\DisplayController->display() #5 /Applications/MAMP/htdocs/newfolder/joomla40/libraries/src/Dispatcher/ComponentDispatcher.php(146): Joomla\CMS\MVC\Controller\BaseController->execute('display') #6 /Applications/MAMP/htdocs/newfolder/joomla40/components/com_contact/src/Dispatcher/Dispatcher.php(45): Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() #7 /Applications/MAMP/htdocs/newfolder/joomla40/libraries/src/Component/ComponentHelper.php(389): Joomla\Component\Contact\Site\Dispatcher\Dispatcher->dispatch() #8 /Applications/MAMP/htdocs/newfolder/joomla40/libraries/src/Application/SiteApplication.php(206): Joomla\CMS\Component\ComponentHelper::renderComponent('com_contact') #9 /Applications/MAMP/htdocs/newfolder/joomla40/libraries/src/Application/SiteApplication.php(245): Joomla\CMS\Application\SiteApplication->dispatch() #10 /Applications/MAMP/htdocs/newfolder/joomla40/libraries/src/Application/CMSApplication.php(231): Joomla\CMS\Application\SiteApplication->doExecute() #11 /Applications/MAMP/htdocs/newfolder/joomla40/includes/app.php(63): Joomla\CMS\Application\CMSApplication->execute() #12 /Applications/MAMP/htdocs/newfolder/joomla40/index.php(36): require_once('/Applications/M...') #13 {main}
I.e. instead of getting a 404 from the ContactModel
if (empty($data))
{
throw new \Exception(Text::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND'), 404);
}
we get the result from the HtmlView.php
code
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new GenericDataException(implode("\n", $errors), 500);
}
Note:
Labels |
Added:
?
|
with
catch (\Exception $e)
{
if ($e->getCode() == 404)
{
// Need to go through the error handler to allow Redirect to work.
throw new \Exception($e->getMessage(), 404);
}
else
{
$this->setError($e);
$this->_item[$pk] = false;
}
}
should work as expected ..... can you confirm ?
sure i'll do shortly
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-09-14 18:07:02 |
Closed_By | ⇒ | alikon |
@Formatio-hippocampi
please test pr. thanks
Issue confirmed for