git: b94bed7479ba - main - lang/php84: fix build with LibreSSL
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 18 Mar 2026 18:24:14 UTC
The branch main has been updated by vishwin:
URL: https://cgit.FreeBSD.org/ports/commit/?id=b94bed7479ba2be313be4a4e91deb3a7ec9d8c5c
commit b94bed7479ba2be313be4a4e91deb3a7ec9d8c5c
Author: Charlie Li <vishwin@FreeBSD.org>
AuthorDate: 2026-03-18 17:05:41 +0000
Commit: Charlie Li <vishwin@FreeBSD.org>
CommitDate: 2026-03-18 18:23:11 +0000
lang/php84: fix build with LibreSSL
sk_X509_new_reserve does not exist in LibreSSL, only OpenSSL.
Obtained from: OpenBSD ports
Approved by: bofh (maintainer)
Differential Revision: https://reviews.freebsd.org/D55921
---
lang/php84/Makefile | 4 +++
.../files/libressl-patch-ext_openssl_openssl.c | 35 ++++++++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/lang/php84/Makefile b/lang/php84/Makefile
index 2dcdb55d0b97..bb4f3f63ae0e 100644
--- a/lang/php84/Makefile
+++ b/lang/php84/Makefile
@@ -140,6 +140,10 @@ LIB_DEPENDS+= libargon2.so:security/libargon2
CONFIGURE_ARGS+= --with-password-argon2=${LOCALBASE}
. endif
+. if ${SSL_DEFAULT:Mlibressl*}
+EXTRA_PATCHES+= ${PATCHDIR}/libressl-patch-ext_openssl_openssl.c
+. endif
+
CONFIGURE_ENV+= ac_cv_decimal_fp_supported="no" \
lt_cv_path_SED="sed" \
OPENSSL_CFLAGS="-I${OPENSSLINC}" \
diff --git a/lang/php84/files/libressl-patch-ext_openssl_openssl.c b/lang/php84/files/libressl-patch-ext_openssl_openssl.c
new file mode 100644
index 000000000000..68e433e89da7
--- /dev/null
+++ b/lang/php84/files/libressl-patch-ext_openssl_openssl.c
@@ -0,0 +1,35 @@
+https://github.com/openbsd/ports/blob/master/lang/php/8.4/patches/patch-ext_openssl_openssl_c
+
+--- ext/openssl/openssl.c.orig 2026-03-10 15:51:04 UTC
++++ ext/openssl/openssl.c
+@@ -2308,7 +2308,7 @@ static STACK_OF(X509) *php_openssl_load_all_certs_from
+ goto end;
+ }
+
+- if(!(stack = sk_X509_new_reserve(NULL, sk_X509_INFO_num(sk)))) {
++ if(!(stack = sk_X509_new_null())) {
+ php_openssl_store_errors();
+ goto end;
+ }
+@@ -2317,7 +2317,11 @@ static STACK_OF(X509) *php_openssl_load_all_certs_from
+ while (sk_X509_INFO_num(sk)) {
+ xi=sk_X509_INFO_shift(sk);
+ if (xi->x509 != NULL) {
+- sk_X509_push(stack,xi->x509);
++ if(sk_X509_push(stack,xi->x509) == 0) {
++ php_error_docref(NULL, E_ERROR, "Memory allocation failure");
++ sk_X509_pop_free(stack,X509_free);
++ goto end;
++ }
+ xi->x509=NULL;
+ }
+ X509_INFO_free(xi);
+@@ -3828,7 +3832,7 @@ static EVP_PKEY * php_openssl_generate_private_key(str
+ /* {{{ php_openssl_generate_private_key */
+ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req)
+ {
+- if (req->priv_key_bits < MIN_KEY_LENGTH) {
++ if (req->priv_key_type != OPENSSL_KEYTYPE_EC && req->priv_key_bits < MIN_KEY_LENGTH) {
+ php_error_docref(NULL, E_WARNING, "Private key length must be at least %d bits, configured to %d",
+ MIN_KEY_LENGTH, req->priv_key_bits);
+ return NULL;