ZF-11811: Prevent duplicate attributes on <link> tag when using Zend_View_Helper_HeadLink
Description
The createDataStylesheet method in the HeadLink helper creates duplicate element attributes when they're passed into the $extra variable.
For example:
$this->headLink()->appendStylesheet('/css/auth.less', 'all', null, array('rel' => 'stylesheet/less'));
Outputs:
When what is really wanted is:
Comments
Posted by Richard Ayotte (flammon) on 2011-10-10T15:10:39.000+0000
Here's a patch.
--- /usr/share/php/libzend-framework-php/Zend/View/Helper/HeadLink.php 2011-08-08 09:52:13.000000000 -0400 +++ /var/www/interacbh/library/AyotteSoftware/View/Helper/HeadLink.php 2011-10-10 11:05:05.811625279 -0400 @@ -378,8 +378,8 @@ $extras = (array) $extras; }
}
/** @@ -434,4 +434,4 @@ $attributes = compact('rel', 'href', 'type', 'title', 'extras'); return $this->createData($attributes); } -} +} \ No newline at end of file
Posted by Adam Lundrigan (adamlundrigan) on 2011-10-27T19:11:26.000+0000
Your fix modifies the return values of a public method (by removing the 'extras' key). Here is an alternate fix which maintains the same return signature while allowing keys in 'extras' to override the other keys:
All unit tests in the Zend_View_Helper suite pass for me after this addition. Could you please apply this patch and give it a try?
Posted by Adam Lundrigan (adamlundrigan) on 2012-05-22T16:56:11.000+0000
Fixed in trunk (1.12.0): r24814