original_string: protected function checkValidAttachment($filename, &$error) {
      if (!is_string($filename)) {
        $error = sprintf("Filename must be a string but was type %s",
                         gettype($filename));
        return false;
      }
  
      $path_parts = pathinfo($filename);
      if (isset($path_parts['extension'])) {
        if (in_array($path_parts['extension'], self::$extension_blacklist)) {
          $error = sprintf("'%s' is a blacklisted file extension.",
                           $path_parts['extension']);
          return false;
        }
      }
  
      return true;
    }
code: protected function checkValidAttachment($filename, &$error) {
      if (!is_string($filename)) {
        $error = sprintf("Filename must be a string but was type %s",
                         gettype($filename));
        return false;
      }
  
      $path_parts = pathinfo($filename);
      if (isset($path_parts['extension'])) {
        if (in_array($path_parts['extension'], self::$extension_blacklist)) {
          $error = sprintf("'%s' is a blacklisted file extension.",
                           $path_parts['extension']);
          return false;
        }
      }
  
      return true;
    }
code_tokens: protected function checkValidAttachment ( $ filename , & $ error ) { if ( ! is_string ( $ filename ) ) { $ error = sprintf ( "Filename must be a string but was type %s" , gettype ( $ filename ) ) ; return false ; } $ path_parts = pathinfo ( $ filename ) ; if ( isset ( $ path_parts [ 'extension' ] ) ) { if ( in_array ( $ path_parts [ 'extension' ] , self :: $ extension_blacklist ) ) { $ error = sprintf ( "'%s' is a blacklisted file extension." , $ path_parts [ 'extension' ] ) ; return false ; } } return true ; }
docstring: Checks that an attachment is valid.
  
  @param string $filename Filename of the attachment.
  @return bool True if successful, false otherwise.
  @param string &$error Error message to be set if the header is invalid.
docstring_tokens: Checks that an attachment is valid .