From e22a4088ff53d9d34c8c323de4bd3bd372b2c2f7 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 21 Feb 2021 06:58:23 +0100 Subject: update to 0.5.1 drop patch merged upstream --- REFLECTION | 4 +- pcsc-php8.patch | 176 ----------------------------------------------------- php-pecl-pcsc.spec | 10 +-- 3 files changed, 7 insertions(+), 183 deletions(-) delete mode 100644 pcsc-php8.patch diff --git a/REFLECTION b/REFLECTION index 2c60fab..c1b1758 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #91 PC/SC version 0.4.0 ] { +Extension [ extension #91 PC/SC version 0.5.1 ] { - Constants [74] { Constant [ int SCARD_E_BAD_SEEK ] { 2148532265 } @@ -107,7 +107,7 @@ Extension [ extension #91 PC/SC version 0.4.0 ] { Parameter #0 [ $context ] Parameter #1 [ $reader_name ] Parameter #2 [ $preferred_protocol ] - Parameter #3 [ &$active_protocol ] + Parameter #3 [ &$current_protocol ] } } Function [ function scard_disconnect ] { diff --git a/pcsc-php8.patch b/pcsc-php8.patch deleted file mode 100644 index 32bc25a..0000000 --- a/pcsc-php8.patch +++ /dev/null @@ -1,176 +0,0 @@ -From 054ec3d5a3185e29557851a0db339b6524d5d810 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Tue, 9 Feb 2021 07:40:33 +0100 -Subject: [PATCH 1/2] fix build warnings ([-Wunused-variable] and [-Wformat=]) - ---- - pcsc.c | 15 ++++++--------- - 1 file changed, 6 insertions(+), 9 deletions(-) - -diff --git a/pcsc.c b/pcsc.c -index aca54c1..22bfff9 100644 ---- a/pcsc.c -+++ b/pcsc.c -@@ -1,8 +1,6 @@ - /* - +----------------------------------------------------------------------+ -- | PHP Version 5 | -- +----------------------------------------------------------------------+ -- | Copyright (c) 1997-2006 The PHP Group | -+ | Copyright (c) The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | -@@ -102,13 +100,13 @@ static void php_pcsc_ctx_res_dtor(zend_resource *rsrc) { - context=(SCARDCONTEXT)rsrc->ptr; - rc = SCardIsValidContext(context); - if (rc != SCARD_S_SUCCESS) { -- php_error_docref(NULL, E_WARNING, "PC/SC context dtor: SCardIsValidContext returned %s (0x%x)", php_pcsc_error_to_string(rc), rc); -+ php_error_docref(NULL, E_WARNING, "PC/SC context dtor: SCardIsValidContext returned %s (0x%lx)", php_pcsc_error_to_string(rc), rc); - return; - } - - rc = SCardReleaseContext(context); - if (rc != SCARD_S_SUCCESS) { -- php_error_docref(NULL, E_WARNING, "PC/SC context dtor: SCardReleaseContext returned %s (0x%x)", php_pcsc_error_to_string(rc), rc); -+ php_error_docref(NULL, E_WARNING, "PC/SC context dtor: SCardReleaseContext returned %s (0x%lx)", php_pcsc_error_to_string(rc), rc); - return; - } - return; -@@ -127,7 +125,7 @@ static void php_pcsc_conn_res_dtor(zend_resource *rsrc) { - - rc = SCardDisconnect(hCard, SCARD_LEAVE_CARD); - if (rc != SCARD_S_SUCCESS) { -- php_error_docref(NULL, E_WARNING, "PC/SC connection dtor: SCardDisconnect returned %s (0x%x)", php_pcsc_error_to_string(rc), rc); -+ php_error_docref(NULL, E_WARNING, "PC/SC connection dtor: SCardDisconnect returned %s (0x%lx)", php_pcsc_error_to_string(rc), rc); - } - } - -@@ -539,7 +537,6 @@ PHP_FUNCTION(scard_is_valid_context) - Invalidate the PC/SC context */ - PHP_FUNCTION(scard_release_context) - { -- LONG rc = 0; - zval* ctx_res; - SCARDCONTEXT context; - -@@ -547,6 +544,7 @@ PHP_FUNCTION(scard_release_context) - RETURN_NULL(); - } - ZEND_FETCH_RESOURCE(context, SCARDCONTEXT, &ctx_res, -1, PHP_PCSC_CTX_RES_NAME, le_pcsc_ctx_res); -+ (void)context; - - zend_hash_index_del(&EG(regular_list), Z_RES_HANDLE_P(ctx_res)); - RETURN_TRUE; -@@ -669,7 +667,7 @@ PHP_FUNCTION(scard_transmit) - SCARD_IO_REQUEST *recvPci = NULL; - BYTE *sendBuffer; - BYTE *recvBuffer; -- DWORD sendLen, recvLen; -+ DWORD sendLen = 0, recvLen; - LONG rc; - char *apdu; - size_t apduLen; -@@ -734,7 +732,6 @@ PHP_FUNCTION(scard_status) - { - zval* conn_res; - SCARDHANDLE hCard = 0; -- char *strReader = NULL; - DWORD dwProtocol, dwState; - BYTE atrBuffer[32]; - DWORD atrLen; - -From 1d0a009e0252e6be2e020a14f7a2b3fca47a52cc Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Tue, 9 Feb 2021 07:50:34 +0100 -Subject: [PATCH 2/2] add missing arginfo (mandatory for PHP 8) - ---- - pcsc.c | 52 ++++++++++++++++++++++++++++++++++++++++++---------- - 1 file changed, 42 insertions(+), 10 deletions(-) - -diff --git a/pcsc.c b/pcsc.c -index 22bfff9..3b6f788 100644 ---- a/pcsc.c -+++ b/pcsc.c -@@ -44,24 +44,49 @@ ZEND_BEGIN_ARG_INFO_EX(php_pcsc_scard_connect_arginfo, 0, 0, 2) - ZEND_ARG_INFO(1, active_protocol) - ZEND_END_ARG_INFO() - -+ZEND_BEGIN_ARG_INFO_EX(php_pcsc_scard_void, 0, 0, 0) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(php_pcsc_scard_context, 0, 0, 1) -+ ZEND_ARG_INFO(0, context) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(php_pcsc_scard_disconnect, 0, 0, 1) -+ ZEND_ARG_INFO(0, card) -+ ZEND_ARG_INFO(0, disposition) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(php_pcsc_scard_transmit, 0, 0, 2) -+ ZEND_ARG_INFO(0, card) -+ ZEND_ARG_INFO(0, command) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(php_pcsc_scard_card, 0, 0, 1) -+ ZEND_ARG_INFO(0, card) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(php_pcsc_scard_errstr, 0, 0, 1) -+ ZEND_ARG_INFO(0, errno) -+ZEND_END_ARG_INFO() -+ - /* {{{ pcsc_functions[] - * - * Every user visible function must have an entry in pcsc_functions[]. - */ - zend_function_entry pcsc_functions[] = { -- PHP_FE(scard_establish_context, NULL) -- PHP_FE(scard_release_context, NULL) -- PHP_FE(scard_is_valid_context, NULL) -- PHP_FE(scard_list_readers, NULL) -+ PHP_FE(scard_establish_context, php_pcsc_scard_void) -+ PHP_FE(scard_release_context, php_pcsc_scard_context) -+ PHP_FE(scard_is_valid_context, php_pcsc_scard_context) -+ PHP_FE(scard_list_readers, php_pcsc_scard_context) - PHP_FE(scard_connect, php_pcsc_scard_connect_arginfo) - //PHP_FE(scard_reconnect, NULL) -- PHP_FE(scard_disconnect, NULL) -- PHP_FE(scard_transmit, NULL) -- PHP_FE(scard_status, NULL) -+ PHP_FE(scard_disconnect, php_pcsc_scard_disconnect) -+ PHP_FE(scard_transmit, php_pcsc_scard_transmit) -+ PHP_FE(scard_status, php_pcsc_scard_card) - //PHP_FE(scard_get_status_change, NULL) -- PHP_FE(scard_last_errno, NULL) -- PHP_FE(scard_errstr, NULL) -- {NULL, NULL, NULL} -+ PHP_FE(scard_last_errno, php_pcsc_scard_void) -+ PHP_FE(scard_errstr, php_pcsc_scard_errstr) -+ PHP_FE_END - }; - /* }}} */ - -@@ -500,6 +525,10 @@ PHP_FUNCTION(scard_establish_context) - SCARDCONTEXT scard_context = 0; - LONG rc = 0; - -+ if (zend_parse_parameters_none() == FAILURE) { -+ return; -+ } -+ - rc = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &scard_context); - if (rc != SCARD_S_SUCCESS) - { -@@ -796,6 +825,9 @@ PHP_FUNCTION(scard_status) - Retrieve last error code */ - PHP_FUNCTION(scard_last_errno) - { -+ if (zend_parse_parameters_none() == FAILURE) { -+ return; -+ } - RETURN_LONG(PCSC_G(last_errno)); - } - /* }}} */ diff --git a/php-pecl-pcsc.spec b/php-pecl-pcsc.spec index cccf239..59e71ec 100644 --- a/php-pecl-pcsc.spec +++ b/php-pecl-pcsc.spec @@ -14,15 +14,13 @@ Summary: An extension for PHP using the winscard PC/SC API Name: %{?scl_prefix}php-pecl-%{pecl_name} -Version: 0.4.0 +Version: 0.5.1 Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: BSD Group: Development/Languages URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz -Patch0: %{pecl_name}-php8.patch - BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: pcsc-lite-devel @@ -79,8 +77,6 @@ mv %{pecl_name}-%{version} NTS %{?_licensedir:sed -e '/COPYING/s/role="doc"/role="src"/' -i package.xml} cd NTS -%patch0 -p1 -b .pr1 - # Sanity check, really often broken extver=$(sed -n '/#define PHP_PCSC_VERSION/{s/.* "//;s/".*$//;p}' php_pcsc.h) if test "x${extver}" != "x%{version}"; then @@ -201,6 +197,10 @@ cd ../ZTS %changelog +* Sun Feb 21 2021 Remi Collet - 0.5.1-1 +- update to 0.5.1 +- drop patch merged upstream + * Tue Feb 9 2021 Remi Collet - 0.4.0-1 - update to 0.4.0 - add patch for PHP 8 from -- cgit