Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fíx PHP error while accessing non-existant weblink #549

Open
wants to merge 1 commit into
base: 4.0-dev
Choose a base branch
from

Conversation

ManuelHu
Copy link

@ManuelHu ManuelHu commented Feb 7, 2024

Pull Request for Issue (none yet)

Summary of Changes

Inspired by https://github.com/joomla/joomla-cms/blob/bef1c83d20024a9970ae4b821dbf2c61c4e4d517/components/com_content/src/Model/ArticleModel.php#L268-L275

Apparently this is needed to properly propagate the 404 error state?

Testing Instructions

  • create a menu item for a weblink category (resulting in an URL of /links/)
  • append an ID to this URL, i.e. /links/12345. It is important that no weblink or weblink category with this ID exists.
  • Also try this with an existing weblink ID

Expected result

  • non-existing ID: 404 error is show, no PHP errors
  • existing ID: weblink view is shown correctly

Actual result

For the non-existing ID, an error page is shown, but with a PHP error message (instead of a 404):

Fehler: 0 Attempt to assign property "slug" on false


# 	Function 	Location
1 	() 	JROOT/components/com_weblinks/src/View/Weblink/HtmlView.php:62
2 	Joomla\Component\Weblinks\Site\View\Weblink\HtmlView->display() 	JROOT/libraries/src/MVC/Controller/BaseController.php:697
3 	Joomla\CMS\MVC\Controller\BaseController->display() 	JROOT/components/com_weblinks/src/Controller/DisplayController.php:67
4 	Joomla\Component\Weblinks\Site\Controller\DisplayController->display() 	JROOT/libraries/src/MVC/Controller/BaseController.php:730
5 	Joomla\CMS\MVC\Controller\BaseController->execute() 	JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:143
6 	Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() 	JROOT/libraries/src/Component/ComponentHelper.php:361
7 	Joomla\CMS\Component\ComponentHelper::renderComponent() 	JROOT/libraries/src/Application/SiteApplication.php:218
8 	Joomla\CMS\Application\SiteApplication->dispatch() 	JROOT/libraries/src/Application/SiteApplication.php:261
9 	Joomla\CMS\Application\SiteApplication->doExecute() 	JROOT/libraries/src/Application/CMSApplication.php:306
10 	Joomla\CMS\Application\CMSApplication->execute() 	JROOT/includes/app.php:58
11 	require_once() 	JROOT/index.php:32 

Documentation Changes Required

none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant