Making WordPress.org

Changeset 9303


Ignore:
Timestamp:
11/28/2019 02:19:33 AM (4 years ago)
Author:
dd32
Message:

Theme Directory: Add some guard clauses to prevent PHP Notices in Meta Development environments where the full data is not available.

Props dingo_d.
Fixes #4858.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-repo-package.php

    r8913 r9303  
    3838    public function latest_version() {
    3939        $status = get_post_meta( $this->wp_post->ID, '_status', true );
     40
     41        if ( empty( $status ) ) {
     42            return '';
     43        }
     44
    4045        uksort( $status, 'version_compare' );
    4146
     
    6469                return $version;
    6570            case 'theme-url' :
    66                 return $this->wp_post->_theme_url[ $version ];
     71                return $this->wp_post->_theme_url[ $version ] ?? '';
    6772            case 'author-url' :
    68                 return $this->wp_post->_author_url[ $version ];
     73                return $this->wp_post->_author_url[ $version ] ?? '';
    6974            case 'ticket' :
    70                 return $this->wp_post->_ticket_id[ $version ];
     75                return $this->wp_post->_ticket_id[ $version ] ?? '';
    7176            case 'requires':
    7277                $values = $this->wp_post->_requires;
Note: See TracChangeset for help on using the changeset viewer.