]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.4' into PHP-8.0
authorChristoph M. Becker <cmbecker69@gmx.de>
Mon, 8 Feb 2021 18:00:37 +0000 (19:00 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 8 Feb 2021 18:00:37 +0000 (19:00 +0100)
* PHP-7.4:
  Fix locale dependent parsing of PostgreSQL version number

1  2 
ext/pgsql/pgsql.c

index 4685c7cd741e552d4e11be086ec97e9b3b9dc144,22e0825c54c2779f9c4e90e237d3fe663c9e0e4c..7ea7d199ea4b74f46a1708afe54e7a936827e543
@@@ -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);