Skip to content

Commit 92f71d9

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix locale dependent parsing of PostgreSQL version number
2 parents f731477 + 03713ac commit 92f71d9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ext/pgsql/pgsql.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,8 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
598598
}
599599
}
600600
pgsql = (PGconn *) le->ptr;
601-
if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 7.2) {
601+
/* consider to use php_version_compare() here */
602+
if (PQprotocolVersion(pgsql) >= 3 && zend_strtod(PQparameterStatus(pgsql, "server_version"), NULL) >= 7.2) {
602603
pg_result = PQexec(pgsql, "RESET ALL;");
603604
PQclear(pg_result);
604605
}
@@ -4063,14 +4064,16 @@ PHP_FUNCTION(pg_get_notify)
40634064
if (result_type & PGSQL_NUM) {
40644065
add_index_string(return_value, 0, pgsql_notify->relname);
40654066
add_index_long(return_value, 1, pgsql_notify->be_pid);
4066-
if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) {
4067+
/* consider to use php_version_compare() here */
4068+
if (PQprotocolVersion(pgsql) >= 3 && zend_strtod(PQparameterStatus(pgsql, "server_version"), NULL) >= 9.0) {
40674069
add_index_string(return_value, 2, pgsql_notify->extra);
40684070
}
40694071
}
40704072
if (result_type & PGSQL_ASSOC) {
40714073
add_assoc_string(return_value, "message", pgsql_notify->relname);
40724074
add_assoc_long(return_value, "pid", pgsql_notify->be_pid);
4073-
if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) {
4075+
/* consider to use php_version_compare() here */
4076+
if (PQprotocolVersion(pgsql) >= 3 && zend_strtod(PQparameterStatus(pgsql, "server_version"), NULL) >= 9.0) {
40744077
add_assoc_string(return_value, "payload", pgsql_notify->extra);
40754078
}
40764079
}

0 commit comments

Comments
 (0)