? ? Pending

User tests: Successful: Unsuccessful:

avatar sakiss
sakiss
19 Nov 2020

Pull Request for Issue # .

Summary of Changes

This intents to be a procedural improvement rather than a fix or a feature.

The Joomla\CMS\Router\Route::_ can get a Joomla\CMS\Uri\Uri parameter, which is later instantiated again as Uri object.
It creates a new object of the same type from the passed one, for no reason. The created object is a clone of the passed.

Testing Instructions

To be able to check the change, you need to debug the code at the point where the change is applied.

Try adding a code like the following in a layout file.

<?php
$uri = Joomla\CMS\Uri\Uri::getInstance('index.php?option=com_content&view=category');
?>
<a href="<?php echo Joomla\CMS\Router\Route::_($uri)?>">A content link</a>

Actual result BEFORE applying this Pull Request

Although we pass a Uri object, it creates a new one of the same type from our passed object.

Expected result AFTER applying this Pull Request

Uses the passed Uri object

Documentation Changes Required

DKN

avatar sakiss sakiss - open - 19 Nov 2020
avatar sakiss sakiss - change - 19 Nov 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Nov 2020
Category Libraries
avatar sakiss sakiss - change - 19 Nov 2020
The description was changed
avatar sakiss sakiss - edited - 19 Nov 2020
avatar ceford ceford - test_item - 20 Nov 2020 - Tested successfully
avatar ceford
ceford - comment - 20 Nov 2020

I have tested this item successfully on 3b2ce06

I put the test code in the Cassiopeia index.php file just before the end of main. I needed to add use Joomla\CMS\Router\Route; at the top and I had to use one of my own menu link routes, otherwise there are errors. With all that done, and the patch applied, line 186 is used once and line 190 is used 15 times. So I wonder if a saving of 1 in 15 is really worth it.


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

avatar sakiss
sakiss - comment - 20 Nov 2020

line 190 is used 15 times. So I wonder if a saving of 1

Thanks for testing!
The number of times each function is used, depends on the developer's implementation.
IMHO this is not something that should concern the API developers.

avatar sakiss sakiss - change - 20 Nov 2020
The description was changed
avatar sakiss sakiss - edited - 20 Nov 2020
avatar Fedik Fedik - test_item - 23 Nov 2020 - Tested successfully
avatar Fedik
Fedik - comment - 23 Nov 2020

I have tested this item successfully on 3b2ce06


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

avatar gostn gostn - test_item - 25 Nov 2020 - Tested successfully
avatar gostn
gostn - comment - 25 Nov 2020

I have tested this item successfully on 3b2ce06


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

avatar gostn
gostn - comment - 27 Nov 2020

set RTC

avatar alikon alikon - change - 27 Nov 2020
Status Pending Ready to Commit
avatar alikon
alikon - comment - 27 Nov 2020

RTC


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

avatar richard67 richard67 - change - 27 Nov 2020
Labels Added: ? ?
avatar laoneo laoneo - change - 30 Nov 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-11-30 14:37:09
Closed_By laoneo
Labels
avatar laoneo laoneo - close - 30 Nov 2020
avatar laoneo laoneo - merge - 30 Nov 2020
avatar laoneo
laoneo - comment - 30 Nov 2020

Thanks!

Add a Comment

Login with GitHub to post a comment