Make WordPress Core

Opened 9 years ago

Closed 9 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:


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 9 years ago.

Download all attachments as: .zip

Change History (4)

9 years ago

#1 @hakre
9 years ago

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

#2 @dd32
9 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.

#3 @ryan
9 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.