Making WordPress.org

Changeset 8271


Ignore:
Timestamp:
02/18/2019 11:49:56 PM (7 years ago)
Author:
iandunn
Message:

WordCamp Organizer Reminders: Use empty array as default sent email IDs.

The previous code attempted to do this by casting the result to an array, but that accidentally created an array where the first value was an empty string -- i.e., array( 0 => '' ) -- because get_post_meta() returns an empty string when $single is false.

In order to correctly end up with an empty array, the code needs to explicitly check that the returned value isn't already an array.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-mailer.php

    r8270 r8271  
    502502
    503503        foreach ( $wordcamps as $wordcamp ) {
    504             $sent_email_ids = (array) get_post_meta( $wordcamp->ID, 'wcor_sent_email_ids', true );
     504            $sent_email_ids = get_post_meta( $wordcamp->ID, 'wcor_sent_email_ids', true );
     505            if ( ! is_array( $sent_email_ids ) ) {
     506                $sent_email_ids = array();
     507            }
    505508
    506509            foreach ( $reminder_emails as $email ) {
Note: See TracChangeset for help on using the changeset viewer.