Making WordPress.org

Changeset 8329


Ignore:
Timestamp:
02/22/2019 08:29:44 PM (7 years ago)
Author:
iandunn
Message:

WordCamp Budgets Dashboard: Set missing values to false to avoid notice.

The previous code would create an empty array, and then try to reference index 0, which wouldn't exist.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/sponsor-invoices-dashboard.php

    r8326 r8329  
    512512        $last_step_time      = $invoice_sent_at;
    513513        $wordcamp_post       = get_wordcamp_post();
    514         $wordcamp_start_date = ( $wordcamp_post->meta['Start Date (YYYY-mm-dd)'] ?? array() )[0];
    515         $wordcamp_lead_email = ( $wordcamp_post->meta['Email Address'] ?? array() )[0];
    516 
    517         if ( empty( $wordcamp_post ) ) {
     514        $wordcamp_start_date = $wordcamp_post->meta['Start Date (YYYY-mm-dd)'][0] ?? false;
     515        $wordcamp_lead_email = $wordcamp_post->meta['Email Address'][0]           ?? false;
     516
     517        if ( empty( $wordcamp_post ) || ! $wordcamp_lead_email ) {
    518518            // Maybe this is a central.wordcamp.org test sponsor invoice.
    519519            restore_current_blog();
Note: See TracChangeset for help on using the changeset viewer.