The l() function does not accept '#' as a link URL address. Here is a patch that allows this.

Comments

samirnassar’s picture

Version: 6.2 » 7.x-dev
Status: Needs review » Needs work

You should re-roll the patch against HEAD, that is Drupal 7. If you need help making this happen, chime in.

robin monks’s picture

Status: Needs work » Needs review
StatusFileSize
new1.19 KB

Free re-roll compliments of patch bingo.

Robin

Status: Needs review » Needs work

The last submitted patch failed testing.

lilou’s picture

Status: Needs work » Needs review
catch’s picture

Status: Needs review » Needs work

Seems like a reasonable idea, the last patch has tabs in though.

mattconnolly’s picture

Status: Needs work » Needs review
StatusFileSize
new1.19 KB

Last patch revised with spaces instead of tabs:

dawehner’s picture

StatusFileSize
new1.2 KB

the patch itself makes total sense for me

but i would check for !== because its faster

additional i realized a coding style problem in the function l()

<?php
  $options += array(
      'attributes' => array(),
      'html' => FALSE,
    );
?>

here is a patch, which fixes the !== problem

i realized that your patch uses the old code style "foo". $bar, corrected this

damien tournoud’s picture

Why do we call check_url() on the result of url()? Don't url() already protect us from harmful protocols by calling filter_xss_bad_protocol() itself when required? I understand that this patch has nothing to do with this, but this would require at least a comment if it's legit.

dawehner’s picture

StatusFileSize
new2.7 KB

yes definitive

its also a (performance) bug in d6 and d5

the patch also fixes the coding style problem in #7

running tests at the moment

catch’s picture

I noticed the multiple calls to filter_xss_bad_protocol() yesterday when cachegrinding HEAD, but hadn't looked to see where they were coming from yet. Nicely spotted - moved to #354812: filter_xss_bad_protocol is called hundreds of times on some pages. since it deserves it's own issue.

Status: Needs review » Needs work

The last submitted patch failed testing.

jody lynn’s picture

Version: 7.x-dev » 8.x-dev
datarazor’s picture

Hello, thanks for this patch. I'm using it on one site, this patch is indeed failing when run. As far as I can tell only:

+  if ($path !== '#') {
+    $path = url($path, $options);
+  }

- return '<a href="' . check_plain(url($path, $options)) . '"' . drupal_attributes($options['attributes']) . '>' . ($options['html'] ? $text : check_plain($text)) . '</a>';
+ return '<a href="' . $path . '"' . drupal_attributes($options['attributes']) . '>' . ($options['html'] ? $text : check_plain($text)) . '</a>';

Is required to allow "#" to be displayed. I'm not too sure why the other lines are in the patch since they are not changed?

dawehner’s picture

Wow, that's pure nostalgia, a CVS patch :)

Not sure whether this issue is actually needed because you can achieve this using the following trick: http://api.drupal.org/comment/15669#comment-15669

dawehner’s picture

Issue summary: View changes
Status: Needs work » Fixed

Yeah, this is not needed anymore at that point in time.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.