summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-09-10 14:41:56 +0200
committerRemi Collet <remi@remirepo.net>2021-09-10 14:41:56 +0200
commit186a34f6a0be991ded1a892a51cb64c748d980a3 (patch)
treecfc728078d79e07e64076abcfd7c6265aed7d7ea
parent541c91f71e648aa86407655319980f11366f8213 (diff)
add patch for PHP 8.1 fromHEADmaster
https://github.com/gamringer/php-pkcs11/pull/59
-rw-r--r--php-pecl-pkcs11.spec12
-rw-r--r--pkcs11-php81.patch78
2 files changed, 89 insertions, 1 deletions
diff --git a/php-pecl-pkcs11.spec b/php-pecl-pkcs11.spec
index a90fd26..2b8f171 100644
--- a/php-pecl-pkcs11.spec
+++ b/php-pecl-pkcs11.spec
@@ -29,11 +29,13 @@
Summary: PHP Bindings for PKCS11 modules
Name: %{?sub_prefix}php-pecl-%{pecl_name}
Version: 1.0
-Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License: PHP
URL: https://pecl.php.net/package/%{pecl_name}
Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+Patch0: %{pecl_name}-php81.patch
+
BuildRequires: make
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7.4
@@ -61,6 +63,9 @@ Obsoletes: php74-pecl-%{pecl_name} <= %{version}
%if "%{php_version}" > "8.0"
Obsoletes: php80-pecl-%{pecl_name} <= %{version}
%endif
+%if "%{php_version}" > "8.1"
+Obsoletes: php81-pecl-%{pecl_name} <= %{version}
+%endif
%endif
@@ -81,6 +86,7 @@ sed -e 's/role="test"/role="src"/' \
mv %{pecl_name}-%{version} NTS
cd NTS
+%patch0 -p1
find . -type f -exec chmod -x {} ';'
# Sanity check, really often broken
@@ -216,6 +222,10 @@ REPORT_EXIT_STATUS=1 \
%changelog
+* Fri Sep 10 2021 Remi Collet <remi@remirepo.net> - 1.0-2
+- add patch for PHP 8.1 from
+ https://github.com/gamringer/php-pkcs11/pull/59
+
* Wed Mar 24 2021 Remi Collet <remi@remirepo.net> - 1.0-1
- update to 1.0
diff --git a/pkcs11-php81.patch b/pkcs11-php81.patch
new file mode 100644
index 0000000..c1e8023
--- /dev/null
+++ b/pkcs11-php81.patch
@@ -0,0 +1,78 @@
+From 99e8980282d7f05f8956bc071eaa823513d44c15 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 10 Sep 2021 14:35:47 +0200
+Subject: [PATCH] use ZEND_ACC_NOT_SERIALIZABLE for PHP 8.1
+
+---
+ pkcs11int.h | 33 +++++++++++++++++++++++++++++++++
+ pkcs11key.c | 6 +++++-
+ 2 files changed, 38 insertions(+), 1 deletion(-)
+
+diff --git a/pkcs11int.h b/pkcs11int.h
+index 69cd92a..dfbe62b 100644
+--- a/pkcs11int.h
++++ b/pkcs11int.h
+@@ -192,6 +192,8 @@ DECLARE_MAGIC_FUNCS(pkcs11_digestcontext, DigestContext)
+ DECLARE_MAGIC_FUNCS(pkcs11_encryptioncontext, EncryptionContext)
+ DECLARE_MAGIC_FUNCS(pkcs11_decryptioncontext, DecryptionContext)
+
++#if PHP_VERSION_ID < 80100
++
+ #define DEFINE_MAGIC_FUNCS(tt, lowername, classname) \
+ static zend_object *tt##_ctor(zend_class_entry *ce) { \
+ tt##_object *objval = zend_object_alloc(sizeof(tt##_object), ce); \
+@@ -220,6 +222,37 @@ void register_##tt() {
+ ce_Pkcs11_##classname->unserialize = zend_class_unserialize_deny; \
+ }
+
++#else
++
++#define DEFINE_MAGIC_FUNCS(tt, lowername, classname) \
++static zend_object *tt##_ctor(zend_class_entry *ce) { \
++ tt##_object *objval = zend_object_alloc(sizeof(tt##_object), ce); \
++ \
++ zend_object_std_init(&objval->std, ce); \
++ object_properties_init(&objval->std, ce); \
++ objval->std.handlers = &tt##_handlers; \
++ \
++ return &objval->std; \
++} \
++static void tt##_dtor(zend_object *zobj) { \
++ tt##_object *objval = tt##_from_zend_object(zobj); \
++ tt##_shutdown(objval); \
++ zend_object_std_dtor(&objval->std); \
++} \
++void register_##tt() { \
++ zend_class_entry ce; \
++ memcpy(&tt##_handlers, &std_object_handlers, sizeof(zend_object_handlers)); \
++ INIT_NS_CLASS_ENTRY(ce, "Pkcs11", #classname, lowername##_class_functions); \
++ ce.create_object = tt##_ctor; \
++ tt##_handlers.offset = XtOffsetOf(tt##_object, std); \
++ tt##_handlers.clone_obj = NULL; \
++ tt##_handlers.free_obj = tt##_dtor; \
++ ce_Pkcs11_##classname = zend_register_internal_class(&ce); \
++ ce_Pkcs11_##classname->ce_flags |= ZEND_ACC_NOT_SERIALIZABLE; \
++}
++
++#endif
++
+
+ extern void pkcs11_error(CK_RV rv, char *error);
+ extern void general_error(char *generic, char *specific);
+diff --git a/pkcs11key.c b/pkcs11key.c
+index 1b84b43..2d7f493 100644
+--- a/pkcs11key.c
++++ b/pkcs11key.c
+@@ -612,6 +612,10 @@ void register_pkcs11_key() {
+ pkcs11_key_handlers.offset = XtOffsetOf(pkcs11_key_object, std);
+ pkcs11_key_handlers.clone_obj = NULL;
+ ce_Pkcs11_Key = zend_register_internal_class_ex(&ce, ce_Pkcs11_P11Object);
++#if PHP_VERSION_ID < 80100
+ ce_Pkcs11_Key->serialize = zend_class_serialize_deny;
+ ce_Pkcs11_Key->unserialize = zend_class_unserialize_deny;
+-}
+\ No newline at end of file
++#else
++ ce_Pkcs11_Key->ce_flags |= ZEND_ACC_NOT_SERIALIZABLE;
++#endif
++}