From: Christoph M. Becker Date: Mon, 8 Feb 2021 18:00:37 +0000 (+0100) Subject: Merge branch 'PHP-7.4' into PHP-8.0 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=92f71d9d42e620c3a08219728a2bfe1abb85a214;p=php Merge branch 'PHP-7.4' into PHP-8.0 * PHP-7.4: Fix locale dependent parsing of PostgreSQL version number --- 92f71d9d42e620c3a08219728a2bfe1abb85a214 diff --cc ext/pgsql/pgsql.c index 4685c7cd74,22e0825c54..7ea7d199ea --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@@ -598,7 -1423,12 +598,8 @@@ static void php_pgsql_do_connect(INTERN } } pgsql = (PGconn *) le->ptr; - if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 7.2) { -#if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS + /* consider to use php_version_compare() here */ + if (PQprotocolVersion(pgsql) >= 3 && zend_strtod(PQparameterStatus(pgsql, "server_version"), NULL) >= 7.2) { -#else - if (zend_strtod(PG_VERSION, NULL) >= 7.2) { -#endif pg_result = PQexec(pgsql, "RESET ALL;"); PQclear(pg_result); } @@@ -4063,15 -5326,29 +4064,17 @@@ PHP_FUNCTION(pg_get_notify if (result_type & PGSQL_NUM) { add_index_string(return_value, 0, pgsql_notify->relname); add_index_long(return_value, 1, pgsql_notify->be_pid); - if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) { -#if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS + /* consider to use php_version_compare() here */ + if (PQprotocolVersion(pgsql) >= 3 && zend_strtod(PQparameterStatus(pgsql, "server_version"), NULL) >= 9.0) { -#else - if (zend_strtod(PG_VERSION) >= 9.0, NULL) { -#endif -#if HAVE_PQPARAMETERSTATUS add_index_string(return_value, 2, pgsql_notify->extra); -#endif } } if (result_type & PGSQL_ASSOC) { add_assoc_string(return_value, "message", pgsql_notify->relname); add_assoc_long(return_value, "pid", pgsql_notify->be_pid); - if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) { -#if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS + /* consider to use php_version_compare() here */ + if (PQprotocolVersion(pgsql) >= 3 && zend_strtod(PQparameterStatus(pgsql, "server_version"), NULL) >= 9.0) { -#else - if (zend_strtod(PG_VERSION, NULL) >= 9.0) { -#endif -#if HAVE_PQPARAMETERSTATUS add_assoc_string(return_value, "payload", pgsql_notify->extra); -#endif } } PQfreemem(pgsql_notify);