Needs work
Project:
Drupal core
Version:
main
Component:
path.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Aug 2010 at 16:21 UTC
Updated:
7 Oct 2019 at 18:11 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #1
jody lynnGreat find. I tracked down the problem to an oversight in drupal_valid_path which was introduced in #190867: Remove access check for anonymous users when creating aliases.
Comment #2
marcingy commentedThis no longer happens on head.
Comment #3
tedfordgif commentedThe offending code is still in 7.x and 8.x, so the underlying issue is not fixed.
Comment #4
marcingy commentedCan you provide steps to replicate then as following the instructions in step one I could not recreate on head. Or a test that will cause the failure.
Comment #5
tedfordgif commentedDo you have display of notices turned on in your php.ini? If that doesn't do it, I should be able to write a test -- just call drupal_validate_path('node/%', TRUE);.
Comment #6
Ingmar commentedI also have this error...everytime I try to add a menu-item of change one.
The record is written to the database, but it doesn't show in Drupal.
Comment #7
StayingEnPointe.com commentedSubscribing!
I'm having the same problem when I try to change the Parent Link of the "My Blog" menu item.
Does anyone know of a work-around for this problem until it's fixed?Edit: I was able to work around this by editing the DB entries directly, then I had to reload the theme cache by accessing the "Admin/Appearance/" menu.
Comment #8
_kash_ commentedSubscribing
Comment #9
_kash_ commentedThis happens for me if I add a link to the user menu that uses the % to insert the user id to the menu path. For example user/%/bookmarks
Comment #10
_kash_ commentedactive
Comment #11
grendzy commentedEdit: not sure this is right, _menu_link_translate() might need link_path to have some value...
Comment #12
mefisto75 commentedsame as at #7
Comment #13
xjmEdit:
$form_itemdoes not actually appear to be set anywhere.Comment #14
xjmI did a little git detective work and this dates to #151583: Menu - Fixes that make menu module work in D6 in D6, in
menu_valid_path(). Back then$form_itemwas the name of the function's parameter. Since$pathis now just a string, the patch is correct. There's no need to override values loaded from the DB and nothing to override them with.Here's a reroll for core/.
Comment #15
xjmD7 version attached for convenience and testing. If you are encountering this problem, please confirm whether applying this patch and clearing your cache resolves the issue.
Comment #16
grendzy commentedI'm starting to suspect the whole
$dynamic_allowedthing is conceptually flawed. For example, how coulddrupal_valid_path('node/%', TRUE)possibly be evaluated if the node ID is unknown? The function is expected to check access, and_menu_check_access()needs to have the access arguments. Can anyone shed some light here?Comment #17
xjm#16: I think the answer to that question is outside the scope of this issue? It's not that the nid is not known; it's that it's a part of the pattern. I may be misunderstanding the question, though. :)
The cleanup above should be made regardless, but let's have someone who can reproduce the bug test the patch and confirm whether it resolves the issue, or whether the part of the problem where the menu items are broken persists.
Comment #18
xjmMarked #1325984: drupal_valid_path() uses a non defined variable as duplicate.
Comment #19
xjmAlso, WRT the sort of tests that need to be added, from the other issue:
Comment #20
xjmSetting NW for tests.
Comment #21
jody lynnI added a test that adds a dynamic menu item and I can't get it to work.
_menu_link_translate always gives back $item['access'] = FALSE for dynamic paths and I can't make much sense out of that function in general.
So currently it is impossible to add dynamic paths to menus, making this a pretty serious bug.
Comment #22
jody lynnComment #23
jody lynnClosed #1256978: drupal_valid_path: fix&document OR refactor as a duplicate
Comment #24
jody lynnComment #25
droplet commentedsee what testbot said.
Comment #27
avpadernoI still have to understand what the purpose of allowing users to define a menu item with a link containing % is, if
drupal_valid_path($path, TRUE)returnsTRUEonly for tracker/%, between the default paths defined from Drupal.I tried the following code, and
$resultisTRUEonly when$pathis equal to'tracker/%'.The first condition necessary for
drupal_valid_path()to returnTRUEis that the menu item has to_arg functions; the condition is verified for search/node/%, search/user/%, and tracker/%. Between those paths,drupal_valid_path($path, TRUE)returnsTRUEonly for tracker/%.Comment #28
yesct commentedrelated: #1634916: "My account" used across site although "User account" is shown for Menu link title and Path
Comment #29
TonyK commentedThis issue is almost 3 years old. Will this ever be fixed in Drupal 7?
Comment #30
dawehnerIt is a huge problem that we need to support both the old and the new routing system at the same time.
Here is a rough outline how to support the new routing system on top of the menu_router bit in drupal_valid_path.
Comment #31
dawehnerThis fixes dynamic paths for the new routing system, but NOT for the old one, see @todo
Comment #32
ey commentedI'm setting the issue back to 7.x.
Comment #33
mradcliffeI think this needs to be 8.x so #31 can get tested.
Comment #35
pingers commentedThis is related to #2086559: Adding an invalid path alias shows an exception in the UI, in which a ResourceNotFoundException is causing WSOD.
For this reason, I'm promoting this to major and we should test that aliasing a path such as "admin/invalid" at admin/config/search/path/add does not WSOD.
I'll try to re-roll what's there to catch this Exception. I.e. checking if a path is valid should not cause WSOD.
Comment #36
pingers commentedOkay, here's the re-roll.
Comment #39
tim.plunkettDid this work in D6? I can reproduce in D7, meaning that this is not a regression.
Comment #40
David_Rothstein commentedNote that #2106129: drupal_valid_path() Notice: Undefined variable: form_item is semi-duplicate of this issue but now has commits for both Drupal 7 and 8. I'm guessing some of this issue is still valid though (especially the tests).
Comment #47
avpaderno