summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-02-09 08:19:12 +0100
committerRemi Collet <remi@remirepo.net>2021-02-09 08:19:12 +0100
commit13fc23fe73938c48c29f8b747817e2ad04f843cc (patch)
tree4dbd7428bf154f92ff75551e1484a618432d4272
parentff670a32b58a986def189d6770b84ce3c78f1f38 (diff)
update to 0.4.0
add patch for PHP 8 from https://github.com/pcsc-for-php/pcsc/pull/1
-rw-r--r--.gitignore9
-rw-r--r--Makefile3
-rw-r--r--PHPINFO4
-rw-r--r--REFLECTION186
-rw-r--r--pcsc-php8.patch176
-rw-r--r--php-pecl-pcsc.spec56
6 files changed, 330 insertions, 104 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01f0400
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+clog
+package-*.xml
+*.tgz
+*.tar.bz2
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
index 13af741..877f3f3 100644
--- a/Makefile
+++ b/Makefile
@@ -2,3 +2,6 @@ SRCDIR := $(shell pwd)
NAME := $(shell basename $(SRCDIR))
include ../../../common/Makefile
+refl:
+ php -d extension=pcsc --re PC/SC >REFLECTION
+ php -d extension=pcsc --ri PC/SC >PHPINFO
diff --git a/PHPINFO b/PHPINFO
new file mode 100644
index 0000000..e6d023d
--- /dev/null
+++ b/PHPINFO
@@ -0,0 +1,4 @@
+
+PC/SC
+
+PC/SC support => enabled
diff --git a/REFLECTION b/REFLECTION
index 85897c0..2c60fab 100644
--- a/REFLECTION
+++ b/REFLECTION
@@ -1,90 +1,105 @@
-Extension [ <persistent> extension #120 PC/SC version 0.3.1 ] {
+Extension [ <persistent> extension #91 PC/SC version 0.4.0 ] {
- Constants [74] {
- Constant [ integer SCARD_E_BAD_SEEK ] { 2148532265 }
- Constant [ integer SCARD_E_CANCELLED ] { 2148532226 }
- Constant [ integer SCARD_E_CANT_DISPOSE ] { 2148532238 }
- Constant [ integer SCARD_E_CARD_UNSUPPORTED ] { 2148532252 }
- Constant [ integer SCARD_E_CERTIFICATE_UNAVAILABLE ] { 2148532269 }
- Constant [ integer SCARD_E_COMM_DATA_LOST ] { 2148532271 }
- Constant [ integer SCARD_E_DIR_NOT_FOUND ] { 2148532259 }
- Constant [ integer SCARD_E_DUPLICATE_READER ] { 2148532251 }
- Constant [ integer SCARD_E_FILE_NOT_FOUND ] { 2148532260 }
- Constant [ integer SCARD_E_ICC_CREATEORDER ] { 2148532257 }
- Constant [ integer SCARD_E_ICC_INSTALLATION ] { 2148532256 }
- Constant [ integer SCARD_E_INSUFFICIENT_BUFFER ] { 2148532232 }
- Constant [ integer SCARD_E_INVALID_ATR ] { 2148532245 }
- Constant [ integer SCARD_E_INVALID_CHV ] { 2148532266 }
- Constant [ integer SCARD_E_INVALID_HANDLE ] { 2148532227 }
- Constant [ integer SCARD_E_INVALID_PARAMETER ] { 2148532228 }
- Constant [ integer SCARD_E_INVALID_TARGET ] { 2148532229 }
- Constant [ integer SCARD_E_INVALID_VALUE ] { 2148532241 }
- Constant [ integer SCARD_E_NO_ACCESS ] { 2148532263 }
- Constant [ integer SCARD_E_NO_DIR ] { 2148532261 }
- Constant [ integer SCARD_E_NO_FILE ] { 2148532262 }
- Constant [ integer SCARD_E_NO_KEY_CONTAINER ] { 2148532272 }
- Constant [ integer SCARD_E_NO_MEMORY ] { 2148532230 }
- Constant [ integer SCARD_E_NO_READERS_AVAILABLE ] { 2148532270 }
- Constant [ integer SCARD_E_NO_SERVICE ] { 2148532253 }
- Constant [ integer SCARD_E_NO_SMARTCARD ] { 2148532236 }
- Constant [ integer SCARD_E_NO_SUCH_CERTIFICATE ] { 2148532268 }
- Constant [ integer SCARD_E_NOT_READY ] { 2148532240 }
- Constant [ integer SCARD_E_NOT_TRANSACTED ] { 2148532246 }
- Constant [ integer SCARD_E_PCI_TOO_SMALL ] { 2148532249 }
- Constant [ integer SCARD_E_PROTO_MISMATCH ] { 2148532239 }
- Constant [ integer SCARD_E_READER_UNAVAILABLE ] { 2148532247 }
- Constant [ integer SCARD_E_READER_UNSUPPORTED ] { 2148532250 }
- Constant [ integer SCARD_E_SERVER_TOO_BUSY ] { 2148532273 }
- Constant [ integer SCARD_E_SERVICE_STOPPED ] { 2148532254 }
- Constant [ integer SCARD_E_SHARING_VIOLATION ] { 2148532235 }
- Constant [ integer SCARD_E_SYSTEM_CANCELLED ] { 2148532242 }
- Constant [ integer SCARD_E_TIMEOUT ] { 2148532234 }
- Constant [ integer SCARD_E_UNEXPECTED ] { 2148532255 }
- Constant [ integer SCARD_E_UNKNOWN_CARD ] { 2148532237 }
- Constant [ integer SCARD_E_UNKNOWN_READER ] { 2148532233 }
- Constant [ integer SCARD_E_UNKNOWN_RES_MNG ] { 2148532267 }
- Constant [ integer SCARD_E_UNSUPPORTED_FEATURE ] { 2148532255 }
- Constant [ integer SCARD_E_WRITE_TOO_MANY ] { 2148532264 }
- Constant [ integer SCARD_F_COMM_ERROR ] { 2148532243 }
- Constant [ integer SCARD_F_INTERNAL_ERROR ] { 2148532225 }
- Constant [ integer SCARD_F_UNKNOWN_ERROR ] { 2148532244 }
- Constant [ integer SCARD_F_WAITED_TOO_LONG ] { 2148532231 }
- Constant [ integer SCARD_P_SHUTDOWN ] { 2148532248 }
- Constant [ integer SCARD_S_SUCCESS ] { 0 }
- Constant [ integer SCARD_W_CANCELLED_BY_USER ] { 2148532334 }
- Constant [ integer SCARD_W_CARD_NOT_AUTHENTICATED ] { 2148532335 }
- Constant [ integer SCARD_W_CHV_BLOCKED ] { 2148532332 }
- Constant [ integer SCARD_W_EOF ] { 2148532333 }
- Constant [ integer SCARD_W_REMOVED_CARD ] { 2148532329 }
- Constant [ integer SCARD_W_RESET_CARD ] { 2148532328 }
- Constant [ integer SCARD_W_SECURITY_VIOLATION ] { 2148532330 }
- Constant [ integer SCARD_W_UNPOWERED_CARD ] { 2148532327 }
- Constant [ integer SCARD_W_UNRESPONSIVE_CARD ] { 2148532326 }
- Constant [ integer SCARD_W_UNSUPPORTED_CARD ] { 2148532325 }
- Constant [ integer SCARD_W_WRONG_CHV ] { 2148532331 }
- Constant [ integer SCARD_PROTOCOL_RAW ] { 4 }
- Constant [ integer SCARD_PROTOCOL_T0 ] { 1 }
- Constant [ integer SCARD_PROTOCOL_T1 ] { 2 }
- Constant [ integer SCARD_EJECT_CARD ] { 3 }
- Constant [ integer SCARD_LEAVE_CARD ] { 0 }
- Constant [ integer SCARD_RESET_CARD ] { 1 }
- Constant [ integer SCARD_UNPOWER_CARD ] { 2 }
- Constant [ integer SCARD_ABSENT ] { 2 }
- Constant [ integer SCARD_NEGOTIABLE ] { 32 }
- Constant [ integer SCARD_POWERED ] { 16 }
- Constant [ integer SCARD_PRESENT ] { 4 }
- Constant [ integer SCARD_SPECIFIC ] { 64 }
- Constant [ integer SCARD_SWALLOWED ] { 8 }
+ Constant [ int SCARD_E_BAD_SEEK ] { 2148532265 }
+ Constant [ int SCARD_E_CANCELLED ] { 2148532226 }
+ Constant [ int SCARD_E_CANT_DISPOSE ] { 2148532238 }
+ Constant [ int SCARD_E_CARD_UNSUPPORTED ] { 2148532252 }
+ Constant [ int SCARD_E_CERTIFICATE_UNAVAILABLE ] { 2148532269 }
+ Constant [ int SCARD_E_COMM_DATA_LOST ] { 2148532271 }
+ Constant [ int SCARD_E_DIR_NOT_FOUND ] { 2148532259 }
+ Constant [ int SCARD_E_DUPLICATE_READER ] { 2148532251 }
+ Constant [ int SCARD_E_FILE_NOT_FOUND ] { 2148532260 }
+ Constant [ int SCARD_E_ICC_CREATEORDER ] { 2148532257 }
+ Constant [ int SCARD_E_ICC_INSTALLATION ] { 2148532256 }
+ Constant [ int SCARD_E_INSUFFICIENT_BUFFER ] { 2148532232 }
+ Constant [ int SCARD_E_INVALID_ATR ] { 2148532245 }
+ Constant [ int SCARD_E_INVALID_CHV ] { 2148532266 }
+ Constant [ int SCARD_E_INVALID_HANDLE ] { 2148532227 }
+ Constant [ int SCARD_E_INVALID_PARAMETER ] { 2148532228 }
+ Constant [ int SCARD_E_INVALID_TARGET ] { 2148532229 }
+ Constant [ int SCARD_E_INVALID_VALUE ] { 2148532241 }
+ Constant [ int SCARD_E_NO_ACCESS ] { 2148532263 }
+ Constant [ int SCARD_E_NO_DIR ] { 2148532261 }
+ Constant [ int SCARD_E_NO_FILE ] { 2148532262 }
+ Constant [ int SCARD_E_NO_KEY_CONTAINER ] { 2148532272 }
+ Constant [ int SCARD_E_NO_MEMORY ] { 2148532230 }
+ Constant [ int SCARD_E_NO_READERS_AVAILABLE ] { 2148532270 }
+ Constant [ int SCARD_E_NO_SERVICE ] { 2148532253 }
+ Constant [ int SCARD_E_NO_SMARTCARD ] { 2148532236 }
+ Constant [ int SCARD_E_NO_SUCH_CERTIFICATE ] { 2148532268 }
+ Constant [ int SCARD_E_NOT_READY ] { 2148532240 }
+ Constant [ int SCARD_E_NOT_TRANSACTED ] { 2148532246 }
+ Constant [ int SCARD_E_PCI_TOO_SMALL ] { 2148532249 }
+ Constant [ int SCARD_E_PROTO_MISMATCH ] { 2148532239 }
+ Constant [ int SCARD_E_READER_UNAVAILABLE ] { 2148532247 }
+ Constant [ int SCARD_E_READER_UNSUPPORTED ] { 2148532250 }
+ Constant [ int SCARD_E_SERVER_TOO_BUSY ] { 2148532273 }
+ Constant [ int SCARD_E_SERVICE_STOPPED ] { 2148532254 }
+ Constant [ int SCARD_E_SHARING_VIOLATION ] { 2148532235 }
+ Constant [ int SCARD_E_SYSTEM_CANCELLED ] { 2148532242 }
+ Constant [ int SCARD_E_TIMEOUT ] { 2148532234 }
+ Constant [ int SCARD_E_UNEXPECTED ] { 2148532255 }
+ Constant [ int SCARD_E_UNKNOWN_CARD ] { 2148532237 }
+ Constant [ int SCARD_E_UNKNOWN_READER ] { 2148532233 }
+ Constant [ int SCARD_E_UNKNOWN_RES_MNG ] { 2148532267 }
+ Constant [ int SCARD_E_UNSUPPORTED_FEATURE ] { 2148532255 }
+ Constant [ int SCARD_E_WRITE_TOO_MANY ] { 2148532264 }
+ Constant [ int SCARD_F_COMM_ERROR ] { 2148532243 }
+ Constant [ int SCARD_F_INTERNAL_ERROR ] { 2148532225 }
+ Constant [ int SCARD_F_UNKNOWN_ERROR ] { 2148532244 }
+ Constant [ int SCARD_F_WAITED_TOO_LONG ] { 2148532231 }
+ Constant [ int SCARD_P_SHUTDOWN ] { 2148532248 }
+ Constant [ int SCARD_S_SUCCESS ] { 0 }
+ Constant [ int SCARD_W_CANCELLED_BY_USER ] { 2148532334 }
+ Constant [ int SCARD_W_CARD_NOT_AUTHENTICATED ] { 2148532335 }
+ Constant [ int SCARD_W_CHV_BLOCKED ] { 2148532332 }
+ Constant [ int SCARD_W_EOF ] { 2148532333 }
+ Constant [ int SCARD_W_REMOVED_CARD ] { 2148532329 }
+ Constant [ int SCARD_W_RESET_CARD ] { 2148532328 }
+ Constant [ int SCARD_W_SECURITY_VIOLATION ] { 2148532330 }
+ Constant [ int SCARD_W_UNPOWERED_CARD ] { 2148532327 }
+ Constant [ int SCARD_W_UNRESPONSIVE_CARD ] { 2148532326 }
+ Constant [ int SCARD_W_UNSUPPORTED_CARD ] { 2148532325 }
+ Constant [ int SCARD_W_WRONG_CHV ] { 2148532331 }
+ Constant [ int SCARD_PROTOCOL_RAW ] { 4 }
+ Constant [ int SCARD_PROTOCOL_T0 ] { 1 }
+ Constant [ int SCARD_PROTOCOL_T1 ] { 2 }
+ Constant [ int SCARD_EJECT_CARD ] { 3 }
+ Constant [ int SCARD_LEAVE_CARD ] { 0 }
+ Constant [ int SCARD_RESET_CARD ] { 1 }
+ Constant [ int SCARD_UNPOWER_CARD ] { 2 }
+ Constant [ int SCARD_ABSENT ] { 2 }
+ Constant [ int SCARD_NEGOTIABLE ] { 32 }
+ Constant [ int SCARD_POWERED ] { 16 }
+ Constant [ int SCARD_PRESENT ] { 4 }
+ Constant [ int SCARD_SPECIFIC ] { 64 }
+ Constant [ int SCARD_SWALLOWED ] { 8 }
}
- Functions {
Function [ <internal:PC/SC> function scard_establish_context ] {
+
+ - Parameters [0] {
+ }
}
Function [ <internal:PC/SC> function scard_release_context ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $context ]
+ }
}
Function [ <internal:PC/SC> function scard_is_valid_context ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $context ]
+ }
}
Function [ <internal:PC/SC> function scard_list_readers ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $context ]
+ }
}
Function [ <internal:PC/SC> function scard_connect ] {
@@ -96,14 +111,35 @@ Extension [ <persistent> extension #120 PC/SC version 0.3.1 ] {
}
}
Function [ <internal:PC/SC> function scard_disconnect ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> $card ]
+ Parameter #1 [ <optional> $disposition ]
+ }
}
Function [ <internal:PC/SC> function scard_transmit ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> $card ]
+ Parameter #1 [ <required> $command ]
+ }
}
Function [ <internal:PC/SC> function scard_status ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $card ]
+ }
}
Function [ <internal:PC/SC> function scard_last_errno ] {
+
+ - Parameters [0] {
+ }
}
Function [ <internal:PC/SC> function scard_errstr ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $errno ]
+ }
}
}
}
diff --git a/pcsc-php8.patch b/pcsc-php8.patch
new file mode 100644
index 0000000..32bc25a
--- /dev/null
+++ b/pcsc-php8.patch
@@ -0,0 +1,176 @@
+From 054ec3d5a3185e29557851a0db339b6524d5d810 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+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 <remi@remirepo.net>
+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 1abd2ea..cccf239 100644
--- a/php-pecl-pcsc.spec
+++ b/php-pecl-pcsc.spec
@@ -1,6 +1,6 @@
# spec file for php-pecl-pcsc
#
-# Copyright (c) 2014-2019 Remi Collet
+# Copyright (c) 2014-2021 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
@@ -8,25 +8,25 @@
#
%{?scl: %scl_package php-pecl-pcsc}
-%global with_zts 0%{?__ztsphp:1}
+%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
%global pecl_name pcsc
-%if "%{php_version}" < "5.6"
-%global ini_name %{pecl_name}.ini
-%else
%global ini_name 40-%{pecl_name}.ini
-%endif
Summary: An extension for PHP using the winscard PC/SC API
Name: %{?scl_prefix}php-pecl-%{pecl_name}
-Version: 0.3.1
-Release: 3%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+Version: 0.4.0
+Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
License: BSD
Group: Development/Languages
-URL: http://pecl.php.net/package/%{pecl_name}
-Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+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
-BuildRequires: %{?scl_prefix}php-devel > 5.3
+BuildRequires: %{?scl_prefix}php-devel >= 7.3
BuildRequires: %{?scl_prefix}php-pear
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
@@ -40,26 +40,17 @@ Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release}
Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release}
-%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
+%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
# Other third party repo stuff
-Obsoletes: php53-pecl-%{pecl_name} <= %{version}
-Obsoletes: php53u-pecl-%{pecl_name} <= %{version}
-Obsoletes: php54-pecl-%{pecl_name} <= %{version}
-Obsoletes: php54w-pecl-%{pecl_name} <= %{version}
-%if "%{php_version}" > "5.5"
-Obsoletes: php55u-pecl-%{pecl_name} <= %{version}
-Obsoletes: php55w-pecl-%{pecl_name} <= %{version}
+%if "%{php_version}" > "7.3"
+Obsoletes: php73-pecl-%{pecl_name} <= %{version}
%endif
-%if "%{php_version}" > "5.6"
-Obsoletes: php56u-pecl-%{pecl_name} <= %{version}
-Obsoletes: php56w-pecl-%{pecl_name} <= %{version}
+%if "%{php_version}" > "7.4"
+Obsoletes: php74-pecl-%{pecl_name} <= %{version}
%endif
+%if "%{php_version}" > "8.0"
+Obsoletes: php80-pecl-%{pecl_name} <= %{version}
%endif
-
-%if 0%{?fedora} < 20 && 0%{?rhel} < 7
-# Filter shared private
-%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
-%{?filter_setup}
%endif
@@ -88,6 +79,8 @@ 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
@@ -174,14 +167,14 @@ cd NTS
: Minimal load test for NTS extension
%{__php} --no-php-ini \
--define extension=modules/%{pecl_name}.so \
- --modules | grep PC/SC
+ --modules | grep '^PC/SC$'
%if %{with_zts}
cd ../ZTS
: Minimal load test for ZTS extension
%{__ztsphp} --no-php-ini \
--define extension=modules/%{pecl_name}.so \
- --modules | grep PC/SC
+ --modules | grep '^PC/SC$'
%endif
@@ -208,6 +201,11 @@ cd ../ZTS
%changelog
+* Tue Feb 9 2021 Remi Collet <remi@remirepo.net> - 0.4.0-1
+- update to 0.4.0
+- add patch for PHP 8 from
+ https://github.com/pcsc-for-php/pcsc/pull/1
+
* Mon Jan 21 2019 Remi Collet <remi@remirepo.net> - 0.3.1-3
- cleanup for EL-8