Problem/Motivation

When certain values like 'below' are not set notices are thrown.
- Notice: Undefined index: below in translatable_menu_link_uri_iterate_menu()
- Notice: Undefined index: original_link in translatable_menu_link_uri_iterate_menu()
- Notice: Undefined variable: plugin_id in translatable_menu_link_uri_iterate_menu

Steps to reproduce

Create menu items without a sublevel.

Not having any items below the first will generate the first notice.
Original link can be empty so that can throw a notive.
If that happens $plugin_id is never set and has no default value which will throw another notice.

Proposed resolution

Perform checks and provide a default value where necessary.

I have attached a patch for this.

CommentFileSizeAuthor
missing-checks-defaults.patch1.02 KBthomasdik

Comments

ThomasDik created an issue. See original summary.

dermario’s picture

Status: Active » Needs review
dermario’s picture

Status: Needs review » Reviewed & tested by the community

Tested the patch in our local installation and it works fine. Code looks good for me too. Marking it as RTBC.

anybody’s picture

Confirming RTBC. !empty() could be used instead of isset() but that's a detail.

jsobiecki’s picture

Hi, Im doing final review as part of Global Contribution Weekend.

jsobiecki’s picture

  • jsobiecki committed 822d9712 on 2.x authored by ThomasDik
    Issue #3227471 by ThomasDik, dermario, Anybody: Missing checks causing...
jsobiecki’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all for contribution. I can confirm it works good. I decided to leave isset instead of empty.

Status: Fixed » Closed (fixed)

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