Skip to content

Commit d52bd63

Browse files
committed
Use curl information from library rather than curl --version
There is a chance the curl executable could be of different version than the libcurl used by php. Include the curl library version, the openssl version and zlib version. This is less than curl --version of the form: curl 7.82.0 (x86_64-redhat-linux-gnu) libcurl/7.82.0 OpenSSL/3.0.5 zlib/1.2.11 brotli/1.0.9 libidn2/2.3.3 libpsl/0.21.1 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.46.0 OpenLDAP/2.6.2
1 parent cd09279 commit d52bd63

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

functions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ function get_env_details() {
211211
foreach( $php_modules as $php_module ) {
212212
$env['php_modules'][ $php_module ] = phpversion( $php_module );
213213
}
214-
$curl_bits = explode( PHP_EOL, str_replace( 'curl ', '', shell_exec( 'curl --version' ) ) );
215-
$curl = array_shift( $curl_bits );
216-
$env['system_utils']['curl'] = trim( $curl );
214+
function curl_selected_bits($k) { return in_array($k, array('version', 'ssl_version', 'libz_version')); }
215+
$curl_bits = curl_version();
216+
$env['system_utils']['curl'] = implode(' ',array_values(array_filter($curl_bits, 'curl_selected_bits',ARRAY_FILTER_USE_KEY) ));
217217
$env['system_utils']['ghostscript'] = trim( shell_exec( 'gs --version' ) );
218218
if ( class_exists( 'Imagick' ) ) {
219219
$imagick = new Imagick();

prepare.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@
7777
foreach( \$php_modules as \$php_module ) {
7878
\$env['php_modules'][ \$php_module ] = phpversion( \$php_module );
7979
}
80-
\$curl_bits = explode( PHP_EOL, str_replace( 'curl ', '', shell_exec( 'curl --version' ) ) );
81-
\$curl = array_shift( \$curl_bits );
82-
\$env['system_utils']['curl'] = trim( \$curl );
80+
function curl_selected_bits(\$k) { return in_array(\$k, array('version', 'ssl_version', 'libz_version')); }
81+
\$curl_bits = curl_version();
82+
\$env['system_utils']['curl'] = implode(' ',array_values(array_filter(\$curl_bits, 'curl_selected_bits',ARRAY_FILTER_USE_KEY) ));
8383
\$env['system_utils']['ghostscript'] = trim( shell_exec( 'gs --version' ) );
8484
if ( class_exists( 'Imagick' ) ) {
8585
\$imagick = new Imagick();

0 commit comments

Comments
 (0)