Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
To replicate change the Menu Title for "My Account" to anything else and click save.
This will change it, but Drupal throws an undefined variable message at you.
Comment | File | Size | Author |
---|---|---|---|
#36 | path-876580-36.patch | 3.94 KB | pingers |
#31 | path-876580-31.patch | 3.94 KB | dawehner |
#30 | path-876580-30.patch | 2.89 KB | dawehner |
#21 | 876580.patch | 1.88 KB | Jody Lynn |
#15 | form_item_cruft-876580-d7.patch | 686 bytes | xjm |
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 CreditAttribution: marcingy commentedThis no longer happens on head.
Comment #3
tedfordgif CreditAttribution: tedfordgif commentedThe offending code is still in 7.x and 8.x, so the underlying issue is not fixed.
Comment #4
marcingy CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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_ CreditAttribution: _KASH_ commentedSubscribing
Comment #9
_KASH_ CreditAttribution: _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_ CreditAttribution: _KASH_ commentedactive
Comment #11
grendzy CreditAttribution: grendzy commentedEdit: not sure this is right, _menu_link_translate() might need link_path to have some value...
Comment #12
mefisto75 CreditAttribution: mefisto75 commentedsame as at #7
Comment #13
xjmEdit:
$form_item
does 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_item
was the name of the function's parameter. Since$path
is 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 CreditAttribution: grendzy commentedI'm starting to suspect the whole
$dynamic_allowed
thing 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 CreditAttribution: droplet commentedsee what testbot said.
Comment #27
apadernoI 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)
returnsTRUE
only for tracker/%, between the default paths defined from Drupal.I tried the following code, and
$result
isTRUE
only when$path
is equal to'tracker/%'
.The first condition necessary for
drupal_valid_path()
to returnTRUE
is 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)
returnsTRUE
only for tracker/%.Comment #28
YesCT CreditAttribution: YesCT commentedrelated: #1634916: "My account" used across site although "User account" is shown for Menu link title and Path
Comment #29
TonyK CreditAttribution: 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
Elin Yordanov CreditAttribution: Elin Yordanov 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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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
apaderno