When validating segments currently the only check that is done is drupal_valid_path($segment_normal_path). This function checks if the current path is valid OR it has a valid ancestor. Since the validated path isn't necessarily the $segment_normal_path, I feel this segment could still be marked as invalid after a further check.

One example of this is the configure page for the Easy breadcrumb block itself. If you go to /admin/structure/block/manage/easy_breadcrumb/easy_breadcrumb/configure
you will see this breadcrumb in the easy breadcrumb block when you enable it:
Home >> Administration >> Structure >> Blocks >> Blocks >> Blocks >> Configure block >> 'Easy Breadcrumb' block
where all 'Blocks' links go to the same parent item and 'Configure block' goes to the current page.

I've made a patch that adds an extra check. If the segment is valid, check to see which path is returned by menu_get_item($segment_normal_path) (this is the path that gets validated by drupal_valid_path) and see if this is the same path. If it's not the same path, mark the segment as invalid.

With this patch (and 'Include invalid paths alias as plain-text segments' disabled), the above path will give this breadcrumb:
Home >> Administration >> Structure >> Blocks >> 'Easy Breadcrumb' block.

Len

CommentFileSizeAuthor
easy-breadcrumb-valid-ancestor_0_1.patch873 byteslendude

Comments

sonemonu’s picture

Thanks.

This is going to be applied in the next release. Possible this weekend or next week.

sonemonu’s picture

Assigned: Unassigned » sonemonu
sonemonu’s picture

Version: 7.x-2.9 » 7.x-2.10
Status: Active » Closed (fixed)

Hey Lennard,

This should be corrected in the release 7.x-2.10 (using your patch). Could you please confirm this works fine for you in the 7.x-2.10 released on 2014-Jun-13?

Thanks!

lendude’s picture

Yeah, works great, thanks for the quick update!

However the breadcrumb for the path I used as an example now looks like
Home >> Administration >> Structure >> Blocks >> '<em class="placeholder">Easy Breadcrumb</em>' block
but this is probably due to the XSS fix that was done and completely unrelated to this issue

Len

sonemonu’s picture

Version: 7.x-2.10 » 7.x-2.11

Hey Len,

Yes, in fact, that was a recent correction. If you want to add some custom styles to the segment of the breadcrumb pointing to the current page, you can use the class "easy-breadcrumb_segment-title" which is automatically added to such segment. There is also the class "easy-breadcrumb_segment-front" which is automatically added to the segment pointing to the front page. All the others segments are marked with the class "easy-breadcrumb_segment".

Roger Padilla

greg boggs’s picture

Status: Closed (fixed) » Needs work

This patch was reverted in the last stable release, see: https://www.drupal.org/node/2291127. If you'd like to continue work on the feature, please do so in this thread, but make sure to test the failure mentioned in 2291127.

lendude’s picture

greg boggs’s picture

Version: 7.x-2.11 » 7.x-2.x-dev
tatarbj’s picture

Assigned: sonemonu » tatarbj

I'm on it - Thanks Greg!

tatarbj’s picture

I confirm when the patch related code is not present, the issue still occures, so it needs more work (and tests) to avoid similar case that happened after 2.12 release, reported under #2291127

tatarbj’s picture

Assigned: tatarbj » Unassigned
Status: Needs work » Fixed

It got fixed in 2.13 release.

Status: Fixed » Closed (fixed)

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