?
avatar dimamizou
dimamizou
17 Feb 2015

Steps to reproduce the issue

Add this code somewhere in a system plugin:

$document = JFactory::getDocument();
$document->addHeadLink('/mysite/site-map', 'next', 'rel');
$document->addHeadLink('/mysite/site-map', 'contents', 'rel');

Expected result

The resulting HTML should contain multiple links to /mysite/site-map (ít is not only allowed but also very legitimate case):

<link href="/mysite/site-map" rel="next"/>
<link href="/mysite/site-map" rel="contents"/>

Actual result

Resulting HTML contains only the link added at last:
<link href="/mysite/site-map" rel="contents"/>

System information (as much as possible)

PHP Built On Linux 2.6.32-504.8.1.el6.i686 #1 SMP Wed Jan 28 18:25:26 UTC 2015 i686
Database Version 5.1.73
Database Collation utf8_general_ci
PHP Version 5.3.3
Web Server Apache/2.2.15 (CentOS)
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 2.5.11 Stable [ Ember ] 26-April-2013 14:00 GMT
Joomla! Platform Version Joomla Platform 11.4.0 Stable [ Brian Kernighan ] 03-Jan-2012 00:00 GMT

Additional comments

This behaviour (introduced in 2.5) leads to unpredictable results in HTML head, especially when addHeadLink is called from different places (extensions, plugins). The reason, why JDocumentHTML must store the links in a map by HREF, is beyond my comprehension. The unique key for head links should be (if any) HREF+REL.

avatar dimamizou dimamizou - open - 17 Feb 2015
avatar dimamizou
dimamizou - comment - 17 Feb 2015

I don't know why, but this fancy editor swallowed the half of my text in Expected result and Actual result although preview displayed everything ok. It must have been some "special chars" or whatsoever.
I must say: I don't have time to learn another freaking Wiki markup! Link "Markup Help" here or use TEXTAREA!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6117.
avatar brianteeman
brianteeman - comment - 17 Feb 2015

You are reporting a bug in Joomla! 2.5.11 ???

This version is exceedingly old and has been updated many times to 2.5.28

Since December 2014 Joomla 2.5 is no longer supported at all.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6117.
avatar brianteeman brianteeman - change - 17 Feb 2015
Priority Urgent Medium
Status New Information Required
avatar brianteeman brianteeman - change - 18 Feb 2015
Labels Added: ?
avatar Bakual
Bakual - comment - 18 Feb 2015

Closing this issue because it's about the no longer supported Joomla 2.5.

If that issue still exists in 3.x, feel free to reopen the issue or create a new one.

avatar Bakual Bakual - change - 18 Feb 2015
The description was changed
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2015-02-18 07:45:10
avatar Bakual Bakual - close - 18 Feb 2015
avatar Bakual Bakual - close - 18 Feb 2015
avatar dimamizou
dimamizou - comment - 18 Feb 2015

If you would care about your project you would - instead of practicing tracker bureaucracy - look into code base (libraries/joomla/document/html/html.php JDocumentHTML::addHeadLink) and see that this error persists as well in release 2.5.28 as in 3.3.6. Who are you, IRS?

avatar dimamizou dimamizou - change - 18 Feb 2015
Title
JDocumentHTML::addHeadLink doesn't allow adding different links to same URI (new in 2.5)
JDocumentHTML::addHeadLink doesn't allow adding different links to same URI (new since 2.5)
avatar dimamizou dimamizou - change - 18 Feb 2015
Title
JDocumentHTML::addHeadLink doesn't allow adding different links to same URI (new in 2.5)
JDocumentHTML::addHeadLink doesn't allow adding different links to same URI (new since 2.5)
avatar dimamizou
dimamizou - comment - 18 Feb 2015

Yes, Bakual, I would like to reopen the issue... How? I can edit but can't change status?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6117.
avatar brianteeman
brianteeman - comment - 18 Feb 2015

I am re-opening this issue as it has now been stated that it is present in a supported release

(It is because we care that we don't and can't waste time on reports of issues in unsupported versions)


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6117.
avatar brianteeman brianteeman - change - 18 Feb 2015
Status Closed New
Closed_Date 2015-02-18 07:45:10
avatar brianteeman brianteeman - reopen - 18 Feb 2015
avatar brianteeman brianteeman - reopen - 18 Feb 2015
avatar Bakual
Bakual - comment - 19 Feb 2015

@dimamizou Do you want to create a PR to solve this? You seem to know the code a bit.
There is a doc which explains how to do it using the GitHub UI: https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests

I'm not sure yet how this could be changed without breaking backward compatibility.

avatar rdeutz
rdeutz - comment - 19 Feb 2015

I think it is a bug and the behaviour isn't expected as it is now.

avatar Bakual
Bakual - comment - 19 Feb 2015

The method is here: https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/document/html/html.php#L277
I agree it is wrong currently.

But if you look at where and how the (public!) $this->_links property is used, I don't see how we can change how it is stored without breaking stuff in other places and 3rd parties.

avatar Fedik
Fedik - comment - 19 Feb 2015

@Bakual public "physically", but from dark old times the underscore meant that it is not a public :smile:

avatar infograf768
infograf768 - comment - 19 Feb 2015

FYI, we use this method in languagefilter without any issue (so far)
https://github.com/joomla/joomla-cms/blob/staging/plugins/system/languagefilter/languagefilter.php#L625

avatar Fedik
Fedik - comment - 19 Feb 2015

@infograf768 problem will come when try to use same link more than once, with different rel :wink:
if I right understand

avatar rdeutz rdeutz - change - 19 Feb 2015
Labels Added: ?
avatar rdeutz
rdeutz - comment - 19 Feb 2015

Oh yes, it will break almost all templates, they often change this array with accessing it directly. This is done because you can't set it to an empty array and work from there. So I think we can only change it with the next major version. So in the meantime people they like to have the same href as link with different rel tag need to copy the file to a different location.

avatar brianteeman brianteeman - change - 25 Feb 2015
Labels Removed: ?
avatar zero-24
zero-24 - comment - 16 Jul 2015

Closing as this issue have the Re-evaluate for v4.0 label :smile:

avatar zero-24 zero-24 - change - 16 Jul 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-07-16 11:36:40
Closed_By zero-24
avatar zero-24 zero-24 - close - 16 Jul 2015
avatar zero-24 zero-24 - close - 16 Jul 2015
avatar zero-24 zero-24 - change - 24 Aug 2015
Milestone Added:
avatar zero-24 zero-24 - change - 24 Aug 2015
Milestone Added:

Add a Comment

Login with GitHub to post a comment