Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 4 years ago

#6159 closed defect (bug) (fixed)

bp_activity_thumbnail_content_images() assumes img height/width is always set

Reported by: DJPaul Owned by: DJPaul
Milestone: 2.3 Priority: normal
Severity: normal Version:
Component: Activity Keywords: has-patch
Cc:

Description

bp_activity_thumbnail_content_images parses <img> tags in the main content of an activity object, when generating a summary for the activity stream.

The current implementation assumes that the img tag will always contain width= and height= properties. If the content doesn't contain these properties inside img tags, it causes PHP Warnings.

I discovered this while working on another feature patch, so I don't have an easy unit test ready to prove the bug, though I've attached a patch.

Attachments (1)

6159.1.patch (1.2 KB) - added by DJPaul 4 years ago.

Download all attachments as: .zip

Change History (3)

@DJPaul
4 years ago

#1 @DJPaul
4 years ago

  • Owner set to DJPaul
  • Status changed from new to assigned

#2 @djpaul
4 years ago

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

In 9456:

Activity: update bp_activity_thumbnail_content_images to check that height/width attributes exist on <img> tags before trying to reference them.

Prevents PHP Notices in edge cases involving developers putting custom content through this function.

Fixes #6159

Note: See TracTickets for help on using tickets.