original_string: public static function is_extension_invalid($extension, $oldextension = '') {
          $extension = trim($extension);
          if ($extension === '' || $extension[0] === '.') {
              return true;
          }
  
          $mimeinfo = get_mimetypes_array();
          if ($oldextension !== '') {
              unset($mimeinfo[$oldextension]);
          }
  
          return array_key_exists($extension, $mimeinfo);
      }
code: public static function is_extension_invalid($extension, $oldextension = '') {
          $extension = trim($extension);
          if ($extension === '' || $extension[0] === '.') {
              return true;
          }
  
          $mimeinfo = get_mimetypes_array();
          if ($oldextension !== '') {
              unset($mimeinfo[$oldextension]);
          }
  
          return array_key_exists($extension, $mimeinfo);
      }
code_tokens: public static function is_extension_invalid ( $ extension , $ oldextension = '' ) { $ extension = trim ( $ extension ) ; if ( $ extension === '' || $ extension [ 0 ] === '.' ) { return true ; } $ mimeinfo = get_mimetypes_array ( ) ; if ( $ oldextension !== '' ) { unset ( $ mimeinfo [ $ oldextension ] ) ; } return array_key_exists ( $ extension , $ mimeinfo ) ; }
docstring: Checks if the given file type extension is invalid.
  The added file type extension must be unique and must not begin with a dot.
  
  @param string $extension Extension of the file type to add
  @param string $oldextension Extension prior to update (empty string if adding new type)
  @return bool True if it the file type trying to add already exists
docstring_tokens: Checks if the given file type extension is invalid . The added file type extension must be unique and must not begin with a dot .