From: Remi Collet Date: Mon, 12 Jun 2023 14:25:20 +0000 (+0200) Subject: fix library version in PHPinfo X-Git-Tag: v2.2.3~3^2~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=e0a5926fd4e74fac3ab128ddae275f5ba785af5d;p=m6w6%2Fext-pq fix library version in PHPinfo --- diff --git a/src/php_pq_module.c b/src/php_pq_module.c index cd99217..3d6dacb 100644 --- a/src/php_pq_module.c +++ b/src/php_pq_module.c @@ -105,7 +105,11 @@ static PHP_MINFO_FUNCTION(pq) php_info_print_table_header(3, "Used Library", "Compiled", "Linked"); #ifdef HAVE_PQLIBVERSION libpq_v = PQlibVersion(); - slprintf(libpq_version, sizeof(libpq_version), "%d.%d.%d", libpq_v/10000%100, libpq_v/100%100, libpq_v%100); + if (libpq_v < 100000) { + slprintf(libpq_version, sizeof(libpq_version), "%d.%d.%d", libpq_v/10000, libpq_v/100%100, libpq_v%100); + } else { + slprintf(libpq_version, sizeof(libpq_version), "%d.%d", libpq_v/10000, libpq_v%100); + } #endif php_info_print_table_row(3, "libpq", PHP_PQ_LIBVERSION, libpq_version); php_info_print_table_end();