From 100a19ce408cca382ffc1d3f6f8bba425743f6cf Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Sun, 14 Feb 2021 19:18:00 +0000 Subject: [PATCH] Fix arginfos and tests for PHP 8 --- gnupg.c | 8 +++++++- tests/gnupg_oo_getengineinfo.phpt | 4 ++-- tests/gnupg_res_deletekey.phpt | 2 +- tests/gnupg_res_getengineinfo.phpt | 2 +- tests/gnupgt.inc | 6 ++++-- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gnupg.c b/gnupg.c index 15081ee..3ec2f07 100644 --- a/gnupg.c +++ b/gnupg.c @@ -346,6 +346,12 @@ ZEND_BEGIN_ARG_INFO(arginfo_gnupg_void_function, 0) 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 */ ZEND_BEGIN_ARG_INFO(arginfo_gnupg_armor_function, 0) @@ -446,7 +452,7 @@ ZEND_END_ARG_INFO() /* {{{ functionlist gnupg */ 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_sign, arginfo_gnupg_text_function) PHP_FE(gnupg_verify, arginfo_gnupg_verify_function) diff --git a/tests/gnupg_oo_getengineinfo.phpt b/tests/gnupg_oo_getengineinfo.phpt index 4379f98..5bf677f 100644 --- a/tests/gnupg_oo_getengineinfo.phpt +++ b/tests/gnupg_oo_getengineinfo.phpt @@ -1,5 +1,5 @@ --TEST-- -get keyinfo +get engineinfo --SKIPIF-- --FILE-- @@ -8,7 +8,7 @@ require_once "gnupgt.inc"; gnupgt::import_key(); $gpg = new gnupg(); -$ret = $gpg->getengineinfo($fingerprint); +$ret = $gpg->getengineinfo(); var_dump($ret); ?> --EXPECTF-- diff --git a/tests/gnupg_res_deletekey.phpt b/tests/gnupg_res_deletekey.phpt index 0718809..c32fcca 100644 --- a/tests/gnupg_res_deletekey.phpt +++ b/tests/gnupg_res_deletekey.phpt @@ -9,7 +9,7 @@ gnupgt::import_key(); $gpg = gnupg_init(); gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING); -$ret = gnupg_deletekey($gpg, $fingerprint,true); +$ret = gnupg_deletekey($gpg, $fingerprint, true); var_dump($ret); ?> --EXPECT-- diff --git a/tests/gnupg_res_getengineinfo.phpt b/tests/gnupg_res_getengineinfo.phpt index e6bc0f7..4605a2a 100644 --- a/tests/gnupg_res_getengineinfo.phpt +++ b/tests/gnupg_res_getengineinfo.phpt @@ -1,5 +1,5 @@ --TEST-- -get keyinfo +get engineinfo --SKIPIF-- --FILE-- diff --git a/tests/gnupgt.inc b/tests/gnupgt.inc index 62cf757..25cc1ae 100644 --- a/tests/gnupgt.inc +++ b/tests/gnupgt.inc @@ -183,7 +183,8 @@ class gnupgt { 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, '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(2048, $ret, 0, 'subkeys', 0, 'length'); 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_authenticate'); 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(2048, $ret, 0, 'subkeys', 1, 'length'); self::check_array_from_version('1.7.0', false, $ret, 0, 'subkeys', 1, 'is_cardkey');