WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 8 years ago

#16131 closed defect (bug) (duplicate)

PHP notice when adding RSS Widget

Reported by: solarissmoke Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.1
Component: Widgets Keywords: has-patch commit
Focuses: Cc:

Description

When adding an RSS widget to a Widget Area that doesn't already have an RSS widget, you get the following PHP Notice:

PHP Notice: Undefined index: url in wp\wp-includes\default-widgets.php on line 750

Because $old_instance is an empty array.

Attachments (1)

16131.patch (589 bytes) - added by solarissmoke 9 years ago.
Fix PHP notice when adding new RSS widget

Download all attachments as: .zip

Change History (8)

#1 @solarissmoke
9 years ago

  • Keywords has-patch added

#2 follow-up: @nacin
9 years ago

I don't think the logic in the patch is proper.

Here's what it does: if the new instance has a URL, and it is different from the old instance URL, then $testurl should be true.

But what the new logic does, is force the old instance URL to also exist, thus making test URL false in the instance where a notice would be triggered.

The proper logic would probably be:

$testurl = ( isset($new_instance['url']) && ( ! isset($old_instance['url']) || ($new_instance['url'] != $old_instance['url']) ) )

#3 in reply to: ↑ 2 @solarissmoke
9 years ago

Replying to nacin:

I don't think the logic in the patch is proper.

You're right, it doesn't work correctly. I've updated the patch as per your suggestion.

@solarissmoke
9 years ago

Fix PHP notice when adding new RSS widget

#4 @nacin
9 years ago

  • Keywords 3.2-early commit added
  • Milestone changed from Awaiting Review to Future Release

#6 @SergeyBiryukov
8 years ago

  • Keywords 3.2-early removed
  • Milestone changed from Future Release to 3.3

#7 @SergeyBiryukov
8 years ago

  • Milestone 3.3 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Incorporated into the patch on #16761.

Note: See TracTickets for help on using tickets.