Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#25880 closed defect (bug) (fixed)

wp_notify_postauthor() does not initialize the subject and content text for custom comment types

Reported by: sebet's profile sebet Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 3.8 Priority: normal
Severity: minor Version:
Component: Comments Keywords: has-patch commit
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Unlike wp_notify_moderator(), that uses a switch/case() statement that defaults to comment types of type 'comment', wp_notify_postauthor() uses an if/else(), resulting in $notify_message and $subject undefined var notices when these vars are concatenated later in that same function, when using a custom comment type:

Notice: Undefined variable: notify_message in ...wp-includes\pluggable.php on line 1076
Notice: Undefined variable: subject in ...\wp-includes\pluggable.php on line 1109

This can be easily fixed by initializing the vars ($var = '') or by replacing the if/else() with a switch/case() that defaults to 'comment'.

Attachments (1)

25880.patch (6.6 KB) - added by SergeyBiryukov 12 years ago.

Download all attachments as: .zip

Change History (8)

#1 @sebet
12 years ago

Small correction. I've mentioned wp_notify_moderator() two times by mistake.

Correction:

Unlike, wp_notify_moderator() that uses a switch/case() statement that defaults to comment types of type 'comment', wp_notify_postauthor() uses an if/else()...

#2 @SergeyBiryukov
12 years ago

  • Description modified (diff)

#3 @SergeyBiryukov
12 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.8

We don't have an API for custom comment types yet (see #12668), but I guess some consistency between wp_notify_postauthor() and wp_notify_moderator() would be good.

#4 @meloniq
12 years ago

  • Cc meloniq@… added

#5 @sebet
12 years ago

Yep, consistency is good. Both functions should work in similar way.
Thanks.

#6 @SergeyBiryukov
12 years ago

  • Keywords commit added

#7 @SergeyBiryukov
12 years ago

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

In 26114:

Avoid PHP notices in wp_notify_postauthor() when using a custom comment type.
Use a switch statement for consistency with wp_notify_moderator().

fixes #25880.

Note: See TracTickets for help on using tickets.