[php-src] PHP-8.5: Fix GH-20920: only register PKCS7_NO_DUAL_CONTENT when it is defined
| From: | Eugene Gvozdetsky via Jakub Zelenka | Date: | Tue, 24 Nov 2026 12:09:56 +0000 |
| Subject: | [php-src] PHP-8.5: Fix GH-20920: only register PKCS7_NO_DUAL_CONTENT when it is defined | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-144099@lists.php.net to get a copy of this message | ||
Author: Eugene Gvozdetsky (gvozdetsky)
Committer: Jakub Zelenka (bukka)
Date: 2026-11-24T12:39:06+01:00
Commit: https://github.com/php/php-src/commit/3a956d99e693000daff9327009416722246bc292
Raw diff: https://github.com/php/php-src/commit/3a956d99e693000daff9327009416722246bc292.diff
Fix GH-20920: only register PKCS7_NO_DUAL_CONTENT when it is defined
PKCS7_NO_DUAL_CONTENT was only added in LibreSSL 4.3.0, so the generated
registration in openssl_arginfo.h fails to compile against older releases.
Guard the constant on the macro itself rather than on LIBRESSL_VERSION_NUMBER
so that LibreSSL 4.3.0 and later, which added the macro in response to this
report, keep exposing the constant.
Closes GH-23689
Changed paths:
M NEWS
M ext/openssl/openssl.stub.php
M ext/openssl/openssl_arginfo.h
Diff:
diff --git a/NEWS b/NEWS
index af9564888d13..9d11ecb6d766 100644
--- a/NEWS
+++ b/NEWS
@@ -814,6 +814,9 @@ PHP NEWS
. Fixed bug GH-23758 (PDO_Firebird returns null for non-null empty BLOBs).
(Lazizbek Ergashev)
+- OpenSSL:
+ . Fixed bug GH-20920 (Build failure with LibreSSL). (Eugene Gvozdetsky)
+
- PGSQL:
. Fixed pg_lo_write() rejecting data containing null bytes. (Ilia Alshanetsky)
. Removed pg_service(), unavailable with any released libpq. (KentarouTakeda)
diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php
index 94902a4acf0d..656aed529b34 100644
--- a/ext/openssl/openssl.stub.php
+++ b/ext/openssl/openssl.stub.php
@@ -181,11 +181,13 @@
* @cvalue PKCS7_NOCRL
*/
const PKCS7_NOCRL = UNKNOWN;
+#ifdef PKCS7_NO_DUAL_CONTENT
/**
* @var int
* @cvalue PKCS7_NO_DUAL_CONTENT
*/
const PKCS7_NO_DUAL_CONTENT = UNKNOWN;
+#endif
/**
* @var int
diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h
index 796582c185bb..4247aad7617b 100644
--- a/ext/openssl/openssl_arginfo.h
+++ b/ext/openssl/openssl_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 8233a8abc8ab7145d905d0fa51478edfe1e55a06 */
+ * Stub hash: 75b3f4ed469daaf98f58861490c7f6f30cae7b1c */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL)
@@ -589,7 +589,9 @@ static void register_openssl_symbols(int module_number)
REGISTER_LONG_CONSTANT("PKCS7_NOSMIMECAP", PKCS7_NOSMIMECAP, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PKCS7_CRLFEOL", PKCS7_CRLFEOL, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PKCS7_NOCRL", PKCS7_NOCRL, CONST_PERSISTENT);
+#if defined(PKCS7_NO_DUAL_CONTENT)
REGISTER_LONG_CONSTANT("PKCS7_NO_DUAL_CONTENT", PKCS7_NO_DUAL_CONTENT,
CONST_PERSISTENT);
+#endif
REGISTER_LONG_CONSTANT("OPENSSL_CMS_DETACHED", CMS_DETACHED, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OPENSSL_CMS_TEXT", CMS_TEXT, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OPENSSL_CMS_NOINTERN", CMS_NOINTERN, CONST_PERSISTENT);