Right now the way the Router works will produce conflicts when two (or more) modules have overlapping route rules. Let's consider an alternative Pages plugin, PagesEx for example, with route pattern (?:([a-z]{2})/)?([-\w/]+).
Pages module has a page with slug starting-page
PagesEx module has a page with slug extended-page and a subpage of extended-page with url i-has-bucket, its full url being extended-page/i-has-bucket.
The problem is that 2. will never work, because the Pages module "steals" its route with rule (:str)/(:str), not finding the page and serving 404 instead.
Current workarounds are:
prefixing the route with a literal string like pages-ex/extended-page/i-has-bucket (ugly, unreliable)
hacking core defines.php file to allow disabling of Pages module (even more ugly and also unreliable in case of more conflicting routes)
To fix this issue changes in core and modules are required to make it work as follows:
Router searches for matching pattern.
Pattern match is found, execution is turned over to the owning module while waiting for response.
Module tries to get data and either A - succedes or B - fails
4A. Module found data and reported success to the Router, which stops further search and returns.
4B. Module reports failure to the Router, which continues search for further matches.
5B. Router either finds another match or no other matches are found and router.notfound event is called.
Right now the way the Router works will produce conflicts when two (or more) modules have overlapping route rules. Let's consider an alternative Pages plugin, PagesEx for example, with route pattern
(?:([a-z]{2})/)?([-\w/]+)
.The problem is that 2. will never work, because the Pages module "steals" its route with rule
(:str)/(:str)
, not finding the page and serving 404 instead.Current workarounds are:
To fix this issue changes in core and modules are required to make it work as follows:
router.notfound
event is called.