Skip to:
Content

BuddyPress.org

Changeset 10540


Ignore:
Timestamp:
02/07/2016 11:10:17 AM (4 years ago)
Author:
djpaul
Message:

Emails: handle PHP Notices in backwards compatibility code when a "to" recipient has not been set for an email.

This shouldn't normally occur, but can in certain failure modes, and in unit tests.

See #6592

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/deprecated/2.5.php

    r10504 r10540  
    7474
    7575    $original_value = $value;
    76 
    77     if ( $property === 'to' ) {
     76    $to_changed     = false;
     77
     78    if ( $property === 'to' && $original_value ) {
     79        $to_changed     = true;
     80
    7881        $value          = array_shift( $original_value );
    7982        $recipient_name = $value->get_name();     // Value - name
     
    646649    }
    647650
    648     if ( $property === 'to' ) {
    649         // We always break apart $to, so we always need to rebuild it.
     651    if ( $property === 'to' && $to_changed ) {
     652        // We normally apart $to, so we often need to rebuild it.
    650653        array_unshift( $original_value, new BP_Email_Recipient( $value, $recipient_name ) );
    651654        $value = $original_value;
Note: See TracChangeset for help on using the changeset viewer.