WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#11057 closed defect (bug) (fixed)

Notice: Undefined index: cat in canonical.php on line 128

Reported by: dd32 Owned by: westi
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: Warnings/Notices Keywords: has-patch
Focuses: Cc:

Description

By the look of it, Canonical seems to be accessing GET items without first checking if they exist, See attached patch

Attachments (1)

11057.diff (1.1 KB) - added by dd32 5 years ago.

Download all attachments as: .zip

Change History (4)

@dd325 years ago

comment:1 @hakre5 years ago

I just had only a quick look, maybe isset() needs to be used in case the get variable/index is not set?

comment:2 @dd325 years ago

Thats what empty() is being used for.

isset() And empty() do not issue the undefined warnings, Isset is good when you just want the index to be set, empty() is better when you want it to be set, and have a non-empty value.

comment:3 @ryan5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [12202]) Fix undefined index notice in canonical. Props dd32. fixes #11057

Note: See TracTickets for help on using tickets.