? Pending

User tests: Successful: Unsuccessful:

avatar csthomas
csthomas
6 Nov 2017

Fix bad effect of merged PR #18308

Summary of Changes

If the menu item does not exist for a link like index.php?Itemid=9999 then joomla returns
Call to a member function getParams() on null .../libraries/src/Component/ComponentHelper.php:103

instead of returns only error 404

Testing Instructions

Install joomla 3.8.2 RC.
Before the patch, go to the non-existent menu item, such as index.php?Itemid=9999
After patch you should see only 404 error, which is correct.

Expected result

As described above.

Actual result

As described above.

Documentation Changes Required

No

avatar csthomas csthomas - open - 6 Nov 2017
avatar csthomas csthomas - change - 6 Nov 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 Nov 2017
Category Libraries
avatar csthomas csthomas - change - 6 Nov 2017
Title
Return error 404 instead of error 0 for non exists page like index.php?Itemid=9999
Return error 404 instead of error 0 for non-existent page, ex index.php?Itemid=9999
avatar csthomas csthomas - edited - 6 Nov 2017
avatar franz-wohlkoenig franz-wohlkoenig - test_item - 6 Nov 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 6 Nov 2017

I have tested this item successfully on f281ed5


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

avatar csthomas csthomas - change - 6 Nov 2017
The description was changed
avatar csthomas csthomas - edited - 6 Nov 2017
avatar infograf768 infograf768 - test_item - 6 Nov 2017 - Tested successfully
avatar infograf768
infograf768 - comment - 6 Nov 2017

I have tested this item successfully on f281ed5


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

avatar infograf768
infograf768 - comment - 6 Nov 2017

@izharaazmi
can you check urgently please?

avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Nov 2017
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 6 Nov 2017

RTC after two successful tests.

avatar izharaazmi
izharaazmi - comment - 6 Nov 2017

This is an issue, but for me this doesn't sound the right fix. I'd explain.

avatar infograf768
infograf768 - comment - 6 Nov 2017

@franz-wohlkoenig
Let's take off RTC for now until @izharaazmi posts more.

avatar infograf768 infograf768 - change - 6 Nov 2017
Status Ready to Commit Pending
avatar izharaazmi
izharaazmi - comment - 6 Nov 2017

I'd suggest this patch.

diff --git a/libraries/src/Component/ComponentHelper.php b/libraries/src/Component/ComponentHelper.php
--- a/libraries/src/Component/ComponentHelper.php
+++ b/libraries/src/Component/ComponentHelper.php

@@ -41,9 +41,11 @@ class ComponentHelper
 	 */
 	public static function getComponent($option, $strict = false)
 	{
-		if (isset(static::$components[$option]) || static::load($option))
+		$components = static::getComponents();
+
+		if (isset($components[$option]))
 		{
-			$result = static::$components[$option];
+			$result = $components[$option];
 		}
 		else
 		{
avatar csthomas
csthomas - comment - 6 Nov 2017

At first I had the same idea, but do we care about testing the units of coverage php?

After this changes unit tests won't test method load() with real $option like 'com_content'?
If this is not a problem the I will change it.

avatar izharaazmi
izharaazmi - comment - 6 Nov 2017

About the current PR, the problem is that it would still cause a B/C check if the $option is null. We should only check deprecation if it's passed. Absence of this parameter is what we are trying to encourage by deprecation. Still allowing '*' is bcoz of the B/C constraints.

I don't see a reason why Tests would fail. If thats the case, we may need to fix it separately. Can you please show me what error you find with the tests?

avatar csthomas
csthomas - comment - 6 Nov 2017

The code in if (isset($option) && $option != '*') {...} won't be covered in unit tests.

Then OK I will prepare a new version.

avatar csthomas
csthomas - comment - 6 Nov 2017

Please test again.

avatar izharaazmi izharaazmi - test_item - 6 Nov 2017 - Tested successfully
avatar izharaazmi
izharaazmi - comment - 6 Nov 2017

I have tested this item successfully on 4d58dc3


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

avatar infograf768 infograf768 - test_item - 7 Nov 2017 - Tested successfully
avatar infograf768
infograf768 - comment - 7 Nov 2017

I have tested this item successfully on 4d58dc3


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

avatar infograf768 infograf768 - change - 7 Nov 2017
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 7 Nov 2017

RTC. Thanks folks.

@mbabker Good to go in 3.8.2


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

avatar mbabker mbabker - change - 7 Nov 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-11-07 11:40:26
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 7 Nov 2017
avatar mbabker mbabker - merge - 7 Nov 2017

Add a Comment

Login with GitHub to post a comment