Making WordPress.org


Ignore:
Timestamp:
05/27/2021 12:42:54 AM (4 years ago)
Author:
dd32
Message:

Translations API: Harden the API against invalid input.

This prevents PHP Warnings and hopefully will flag to users of the API when they call it incorrectly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/translations/lib.php

    r10943 r10998  
    1818    if ( $type === 'core' && null === $version ) {
    1919        $version = WP_CORE_LATEST_RELEASE;
     20    }
     21
     22    // Optimize against junk inputs.
     23    if ( ! $domain || ! is_string( $domain ) ) {
     24        return array();
     25    }
     26    if ( $version && ! is_string( $version ) ) {
     27        return array();
    2028    }
    2129
Note: See TracChangeset for help on using the changeset viewer.