fix library version in PHPinfo
authorRemi Collet <remi@remirepo.net>
Mon, 12 Jun 2023 14:25:20 +0000 (16:25 +0200)
committerRemi Collet <remi@php.net>
Tue, 13 Jun 2023 12:56:33 +0000 (14:56 +0200)
src/php_pq_module.c

index cd992172d9e524bc9c6ccdd15d151fcdf43c806e..3d6dacb1e7d6cd7d2d83a28a3034a4a9991603d5 100644 (file)
@@ -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();