Statement on glibc/iconv Vulnerability

gnupg_geterrorinfo

(PECL gnupg >= 1.5)

gnupg_geterrorinfoエラー情報を返す

説明

gnupg_geterrorinfo(resource $identifier): array

パラメータ

identifier

gnupg_init() あるいは gnupg のコールで得られた gnupg ID。

戻り値

エラー情報が含まれる配列を返します。

例1 手続き型 gnupg_geterrorinfo() の例

<?php
$res
= gnupg_init();
// this is called without any error
print_r(gnupg_geterrorinfo($res));
?>

上の例の出力は以下となります。

array(4) {
  ["generic_message"]=>
  bool(false)
  ["gpgme_code"]=>
  int(0)
  ["gpgme_source"]=>
  string(18) "Unspecified source"
  ["gpgme_message"]=>
  string(7) "Success"
}

例2 オブジェクト指向型 gnupg_geterrorinfo() の例

<?php
$gpg
= new gnupg();
// error call
$gpg->decrypt('abc');
// error info should be displayed
print_r($gpg->geterrorinfo());
?>

上の例の出力は以下となります。

array(4) {
  ["generic_message"]=>
  string(14) "decrypt failed"
  ["gpgme_code"]=>
  int(117440570)
  ["gpgme_source"]=>
  string(5) "GPGME"
  ["gpgme_message"]=>
  string(7) "No data"
}

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top