1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Remove conditional pg_encoding_to_char usage (#14557)

The pg_encoding_to_char is available in PostgreSQL since ~7.3 where also
the --enable-multibyte option was removed. PHP minimum PostgreSQL
version at this point is 9.1, which also has the pg_encoding_to_char
declaration in libpq-fe.h.

This removes conditional usage and the HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
symbol.
This commit is contained in:
Peter Kokot
2024-06-13 16:00:16 +02:00
committed by GitHub
parent 4b24f5d6db
commit 2969889fb8
4 changed files with 1 additions and 14 deletions

View File

@@ -65,7 +65,6 @@ if test "$PHP_PGSQL" != "no"; then
old_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -I$PGSQL_INCLUDE"
AC_CHECK_LIB(pq, PQlibVersion,, AC_MSG_ERROR([Unable to build the PostgreSQL extension: at least libpq 9.1 is required]))
AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibyte]))
AC_CHECK_LIB(pq, lo_truncate64, AC_DEFINE(HAVE_PG_LO64,1,[PostgreSQL 9.3 or later]))
AC_CHECK_LIB(pq, PQsetErrorContextVisibility, AC_DEFINE(HAVE_PG_CONTEXT_VISIBILITY,1,[PostgreSQL 9.6 or later]))
AC_CHECK_LIB(pq, PQresultMemorySize, AC_DEFINE(HAVE_PG_RESULT_MEMORY_SIZE,1,[PostgreSQL 12 or later]))

View File

@@ -7,7 +7,7 @@ if (PHP_PGSQL != "no") {
CHECK_HEADER_ADD_INCLUDE("libpq-fe.h", "CFLAGS_PGSQL", PHP_PGSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\pgsql;" + PHP_PHP_BUILD + "\\include\\libpq;" + PHP_PGSQL)) {
EXTENSION("pgsql", "pgsql.c", PHP_PGSQL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('HAVE_PGSQL', 1, 'Have PostgreSQL library');
ADD_FLAG("CFLAGS_PGSQL", "/D PGSQL_EXPORTS /D HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT" + (X64 ? " /D HAVE_PG_LO64" : "") + " ");
ADD_FLAG("CFLAGS_PGSQL", "/D PGSQL_EXPORTS" + (X64 ? " /D HAVE_PG_LO64" : "") + " ");
ADD_EXTENSION_DEP('pgsql', 'pcre');
} else {
WARNING("pgsql not enabled; libraries and headers not found");

View File

@@ -278,10 +278,6 @@ static void pgsql_lob_free_obj(zend_object *obj)
/* Compatibility definitions */
#ifndef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
#define pg_encoding_to_char(x) "SQL_ASCII"
#endif
static zend_string *_php_pgsql_trim_message(const char *message)
{
size_t i = strlen(message);
@@ -601,11 +597,7 @@ PHP_MINFO_FUNCTION(pgsql)
php_info_print_table_start();
php_info_print_table_row(2, "PostgreSQL Support", "enabled");
php_info_print_table_row(2, "PostgreSQL (libpq) Version", pgsql_libpq_version);
#ifdef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
php_info_print_table_row(2, "Multibyte character support", "enabled");
#else
php_info_print_table_row(2, "Multibyte character support", "disabled");
#endif
snprintf(buf, sizeof(buf), ZEND_LONG_FMT, PGG(num_persistent));
php_info_print_table_row(2, "Active Persistent Links", buf);
snprintf(buf, sizeof(buf), ZEND_LONG_FMT, PGG(num_links));

View File

@@ -48,10 +48,6 @@ extern zend_module_entry pgsql_module_entry;
# endif
#endif
#ifdef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
const char * pg_encoding_to_char(int encoding);
#endif
PHP_MINIT_FUNCTION(pgsql);
PHP_MSHUTDOWN_FUNCTION(pgsql);
PHP_RINIT_FUNCTION(pgsql);