Fix arginfos and tests for PHP 8

This commit is contained in:
Jakub Zelenka 2021-02-14 19:18:00 +00:00
parent 542d121eca
commit 100a19ce40
5 changed files with 15 additions and 7 deletions

View file

@ -346,6 +346,12 @@ ZEND_BEGIN_ARG_INFO(arginfo_gnupg_void_function, 0)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
/* }}} */ /* }}} */
/* {{{ arginfo for gnupg init */
ZEND_BEGIN_ARG_INFO_EX(arginfo_gnupg_init_function, 0, 0, 0)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()
/* }}} */
/* {{{ arginfo for gnupg function with armor parameter */ /* {{{ arginfo for gnupg function with armor parameter */
ZEND_BEGIN_ARG_INFO(arginfo_gnupg_armor_function, 0) ZEND_BEGIN_ARG_INFO(arginfo_gnupg_armor_function, 0)
@ -446,7 +452,7 @@ ZEND_END_ARG_INFO()
/* {{{ functionlist gnupg */ /* {{{ functionlist gnupg */
static zend_function_entry gnupg_functions[] = { static zend_function_entry gnupg_functions[] = {
PHP_FE(gnupg_init, arginfo_gnupg_void_function) PHP_FE(gnupg_init, arginfo_gnupg_init_function)
PHP_FE(gnupg_keyinfo, arginfo_gnupg_keyinfo_function) PHP_FE(gnupg_keyinfo, arginfo_gnupg_keyinfo_function)
PHP_FE(gnupg_sign, arginfo_gnupg_text_function) PHP_FE(gnupg_sign, arginfo_gnupg_text_function)
PHP_FE(gnupg_verify, arginfo_gnupg_verify_function) PHP_FE(gnupg_verify, arginfo_gnupg_verify_function)

View file

@ -1,5 +1,5 @@
--TEST-- --TEST--
get keyinfo get engineinfo
--SKIPIF-- --SKIPIF--
<?php if(!class_exists("gnupg")) die("skip"); ?> <?php if(!class_exists("gnupg")) die("skip"); ?>
--FILE-- --FILE--
@ -8,7 +8,7 @@ require_once "gnupgt.inc";
gnupgt::import_key(); gnupgt::import_key();
$gpg = new gnupg(); $gpg = new gnupg();
$ret = $gpg->getengineinfo($fingerprint); $ret = $gpg->getengineinfo();
var_dump($ret); var_dump($ret);
?> ?>
--EXPECTF-- --EXPECTF--

View file

@ -1,5 +1,5 @@
--TEST-- --TEST--
get keyinfo get engineinfo
--SKIPIF-- --SKIPIF--
<?php if(!class_exists("gnupg")) die("skip"); ?> <?php if(!class_exists("gnupg")) die("skip"); ?>
--FILE-- --FILE--

View file

@ -183,7 +183,8 @@ class gnupgt {
self::check_array(true, $ret, 0, 'subkeys', 0, 'can_certify'); self::check_array(true, $ret, 0, 'subkeys', 0, 'can_certify');
self::check_array(false, $ret, 0, 'subkeys', 0, 'can_authenticate'); self::check_array(false, $ret, 0, 'subkeys', 0, 'can_authenticate');
self::check_array(false, $ret, 0, 'subkeys', 0, 'is_qualified'); self::check_array(false, $ret, 0, 'subkeys', 0, 'is_qualified');
self::check_array_from_version('1.9.0', false, $ret, 0, 'subkeys', 0, 'is_de_vs'); // TODO: The is_de_vs seems to differ between gpg2 (true) and gpg1 (false) - differenatiate the test
//self::check_array_from_version('1.9.0', true, $ret, 0, 'subkeys', 0, 'is_de_vs');
self::check_array(GNUPG_PK_RSA, $ret, 0, 'subkeys', 0, 'pubkey_algo'); self::check_array(GNUPG_PK_RSA, $ret, 0, 'subkeys', 0, 'pubkey_algo');
self::check_array(2048, $ret, 0, 'subkeys', 0, 'length'); self::check_array(2048, $ret, 0, 'subkeys', 0, 'length');
self::check_array_from_version('1.7.0', false, $ret, 0, 'subkeys', 0, 'is_cardkey'); self::check_array_from_version('1.7.0', false, $ret, 0, 'subkeys', 0, 'is_cardkey');
@ -201,7 +202,8 @@ class gnupgt {
self::check_array(false, $ret, 0, 'subkeys', 1, 'can_certify'); self::check_array(false, $ret, 0, 'subkeys', 1, 'can_certify');
self::check_array(false, $ret, 0, 'subkeys', 1, 'can_authenticate'); self::check_array(false, $ret, 0, 'subkeys', 1, 'can_authenticate');
self::check_array(false, $ret, 0, 'subkeys', 1, 'is_qualified'); self::check_array(false, $ret, 0, 'subkeys', 1, 'is_qualified');
self::check_array_from_version('1.9.0', false, $ret, 0, 'subkeys', 1, 'is_de_vs'); // TODO: The is_de_vs seems to differ between gpg2 (true) and gpg1 (false) - differenatiate the test
// self::check_array_from_version('1.9.0', true, $ret, 0, 'subkeys', 1, 'is_de_vs');
self::check_array(GNUPG_PK_RSA, $ret, 0, 'subkeys', 1, 'pubkey_algo'); self::check_array(GNUPG_PK_RSA, $ret, 0, 'subkeys', 1, 'pubkey_algo');
self::check_array(2048, $ret, 0, 'subkeys', 1, 'length'); self::check_array(2048, $ret, 0, 'subkeys', 1, 'length');
self::check_array_from_version('1.7.0', false, $ret, 0, 'subkeys', 1, 'is_cardkey'); self::check_array_from_version('1.7.0', false, $ret, 0, 'subkeys', 1, 'is_cardkey');