[php-src] PHP-8.2: Fix linking ext/curl against OpenSSL (#13262) (#25129)
| From: | Shivam Mathur via GitHub | Date: | Sun, 01 Nov 2026 15:40:13 +0000 |
| Subject: | [php-src] PHP-8.2: Fix linking ext/curl against OpenSSL (#13262) (#25129) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143158@lists.php.net to get a copy of this message | ||
Author: Shivam Mathur (shivammathur)
Committer: GitHub (web-flow)
Pusher: shivammathur
Date: 2026-11-01T21:10:10+05:30
Commit: https://github.com/php/php-src/commit/dc5acdb60e04f44c5ef38d32eabf1a90da243289
Raw diff: https://github.com/php/php-src/commit/dc5acdb60e04f44c5ef38d32eabf1a90da243289.diff
Fix linking ext/curl against OpenSSL (#13262) (#25129)
This is backport for 8.3 of b222c020bfa876ae1cea87406beb8af0b53f0fab
that originally targeted only 8.4+. This is however a bug fix.
Following 68f6ab711323678382d2746e57358d3f57a3446b, the ext/curl doesn't
need to be linked against OpenSSL anymore, if curl_version_info_data
ssl_version is OpenSSL/1.1 or later.
With OpenSSL 3 and later the check for old SSL crypto locking callbacks
was detected here.
This also uses a common PHP_SETUP_OPENSSL macro for checking OpenSSL and
syncs the minimum OpenSSL version (currently 1.0.2 or later) across the
PHP build system.
(cherry picked from commit ae92b85572ac9a5f14103cdedbf6448f9e8db09d)
Co-authored-by: Peter Kokot <peterkokot@gmail.com>
Changed paths:
M ext/curl/config.m4
Diff:
diff --git a/ext/curl/config.m4 b/ext/curl/config.m4
index 3b11739654bd..c0325f990ad1 100644
--- a/ext/curl/config.m4
+++ b/ext/curl/config.m4
@@ -28,6 +28,7 @@ if test "$PHP_CURL" != "no"; then
AC_MSG_CHECKING([for libcurl linked against old openssl])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <stdio.h>
#include <strings.h>
#include <curl/curl.h>
@@ -39,9 +40,18 @@ int main(int argc, char *argv[])
const char *ptr = data->ssl_version;
while(*ptr == ' ') ++ptr;
- if (strncasecmp(ptr, "OpenSSL/1.1", sizeof("OpenSSL/1.1")-1) == 0) {
- /* New OpenSSL version */
- return 3;
+ int major, minor;
+ if (sscanf(ptr, "OpenSSL/%d", &major) == 1) {
+ if (major >= 3) {
+ /* OpenSSL version 3 or later */
+ return 4;
+ }
+ }
+ if (sscanf(ptr, "OpenSSL/%d.%d", &major, &minor) == 2) {
+ if (major > 1 || (major == 1 && minor >= 1)) {
+ /* OpenSSL version 1.1 or later */
+ return 3;
+ }
}
if (strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1) == 0) {
/* Old OpenSSL version */
@@ -56,11 +66,7 @@ int main(int argc, char *argv[])
]])],[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_CURL_OLD_OPENSSL], [1], [Have cURL with old OpenSSL])
- PKG_CHECK_MODULES([OPENSSL], [openssl], [
- PHP_EVAL_LIBLINE($OPENSSL_LIBS, CURL_SHARED_LIBADD)
- PHP_EVAL_INCLINE($OPENSSL_CFLAGS)
- AC_CHECK_HEADERS([openssl/crypto.h])
- ], [])
+ PHP_SETUP_OPENSSL(CURL_SHARED_LIBADD,[AC_CHECK_HEADERS([openssl/crypto.h])],[])
], [
AC_MSG_RESULT([no])
], [