What are the steps required to reproduce the bug?

  1. I have a base entity "Dummy" whose main route is /dummy/*.
  2. I can go to its edit form by going to /dummy/*/edit
  3. Dummy has child entities. Child entities can be accessed at /dummy/*/dummy-child/*
  4. I can go to their edit form by going to /dummy/*/dummy-child/*/edit

I create a block and specify the path /dummy/*/edit for the block visibility settings.

What behavior were you expecting?

The block IS NOT visible at /dummy/*/dummy-child/*/edit

What happened instead?

The block IS visible at /dummy/*/dummy-child/*/edit

CommentFileSizeAuthor
#2 path_matcher-2910299-2.patch503 bytesibustos

Comments

ibustos created an issue. See original summary.

ibustos’s picture

StatusFileSize
new503 bytes

The problem seems to be in Drupal\Core\Path\PathMatcher as this fails to match the path properly. This patch modifies core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php illustrating the problem.

ibustos’s picture

Title: PathMatcher not matching paths properly when in a hierarchical path » Block visibility not working as expected
Component: base system » block.module

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
catch’s picture

Status: Active » Closed (works as designed)
Issue tags: +Bug Smash Initiative

The wildcard counts for anything between the two path parts, including additional forward slashes, so while I understand the use case, this is 'by design'. For cases like this you'd be better of writing a small block visibility plugin similar to the node type one.