1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-26 05:02:18 +00:00

security/pecl-pkcs11: Fix build with PHP 8.1

Obtained from:	0df4a939a6
This commit is contained in:
Po-Chuan Hsieh 2022-01-29 07:19:14 +08:00
parent 3f7c81cae8
commit c5e0b8b212
No known key found for this signature in database
GPG Key ID: 9A4BD10F002DD04B
2 changed files with 46 additions and 2 deletions

View File

@ -12,6 +12,4 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
USES= localbase php:pecl
IGNORE_WITH_PHP=81
.include <bsd.port.mk>

View File

@ -0,0 +1,46 @@
Obtained from: https://github.com/gamringer/php-pkcs11/commit/0df4a939a65137ef9002077cad4e6dab8c58c6cc
--- pkcs11int.h.orig 2021-03-23 21:45:06 UTC
+++ pkcs11int.h
@@ -192,6 +192,19 @@ DECLARE_MAGIC_FUNCS(pkcs11_digestcontext,
DECLARE_MAGIC_FUNCS(pkcs11_encryptioncontext, EncryptionContext)
DECLARE_MAGIC_FUNCS(pkcs11_decryptioncontext, DecryptionContext)
+#if PHP_VERSION_ID < 80100
+
+#define PKCS11_ACC_NOT_SERIALIZABLE(ce) \
+ ce->serialize = zend_class_serialize_deny; \
+ ce->unserialize = zend_class_unserialize_deny;
+
+#else
+
+#define PKCS11_ACC_NOT_SERIALIZABLE(ce) \
+ ce->ce_flags |= ZEND_ACC_NOT_SERIALIZABLE;
+
+#endif
+
#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); \
@@ -216,8 +229,7 @@ void register_##tt() {
tt##_handlers.clone_obj = NULL; \
tt##_handlers.free_obj = tt##_dtor; \
ce_Pkcs11_##classname = zend_register_internal_class(&ce); \
- ce_Pkcs11_##classname->serialize = zend_class_serialize_deny; \
- ce_Pkcs11_##classname->unserialize = zend_class_unserialize_deny; \
+ PKCS11_ACC_NOT_SERIALIZABLE(ce_Pkcs11_##classname); \
}
--- pkcs11key.c.orig 2021-03-23 21:45:06 UTC
+++ pkcs11key.c
@@ -612,6 +612,5 @@ 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);
- ce_Pkcs11_Key->serialize = zend_class_serialize_deny;
- ce_Pkcs11_Key->unserialize = zend_class_unserialize_deny;
-}
\ No newline at end of file
+ PKCS11_ACC_NOT_SERIALIZABLE(ce_Pkcs11_Key);
+}