Skip to content

Commit 2969889

Browse files
authored
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.
1 parent 4b24f5d commit 2969889

File tree

4 files changed

+1
-14
lines changed

4 files changed

+1
-14
lines changed

ext/pgsql/config.m4

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ if test "$PHP_PGSQL" != "no"; then
6565
old_CFLAGS=$CFLAGS
6666
CFLAGS="$CFLAGS -I$PGSQL_INCLUDE"
6767
AC_CHECK_LIB(pq, PQlibVersion,, AC_MSG_ERROR([Unable to build the PostgreSQL extension: at least libpq 9.1 is required]))
68-
AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibyte]))
6968
AC_CHECK_LIB(pq, lo_truncate64, AC_DEFINE(HAVE_PG_LO64,1,[PostgreSQL 9.3 or later]))
7069
AC_CHECK_LIB(pq, PQsetErrorContextVisibility, AC_DEFINE(HAVE_PG_CONTEXT_VISIBILITY,1,[PostgreSQL 9.6 or later]))
7170
AC_CHECK_LIB(pq, PQresultMemorySize, AC_DEFINE(HAVE_PG_RESULT_MEMORY_SIZE,1,[PostgreSQL 12 or later]))

ext/pgsql/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (PHP_PGSQL != "no") {
77
CHECK_HEADER_ADD_INCLUDE("libpq-fe.h", "CFLAGS_PGSQL", PHP_PGSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\pgsql;" + PHP_PHP_BUILD + "\\include\\libpq;" + PHP_PGSQL)) {
88
EXTENSION("pgsql", "pgsql.c", PHP_PGSQL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
99
AC_DEFINE('HAVE_PGSQL', 1, 'Have PostgreSQL library');
10-
ADD_FLAG("CFLAGS_PGSQL", "/D PGSQL_EXPORTS /D HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT" + (X64 ? " /D HAVE_PG_LO64" : "") + " ");
10+
ADD_FLAG("CFLAGS_PGSQL", "/D PGSQL_EXPORTS" + (X64 ? " /D HAVE_PG_LO64" : "") + " ");
1111
ADD_EXTENSION_DEP('pgsql', 'pcre');
1212
} else {
1313
WARNING("pgsql not enabled; libraries and headers not found");

ext/pgsql/pgsql.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,6 @@ static void pgsql_lob_free_obj(zend_object *obj)
278278

279279
/* Compatibility definitions */
280280

281-
#ifndef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
282-
#define pg_encoding_to_char(x) "SQL_ASCII"
283-
#endif
284-
285281
static zend_string *_php_pgsql_trim_message(const char *message)
286282
{
287283
size_t i = strlen(message);
@@ -601,11 +597,7 @@ PHP_MINFO_FUNCTION(pgsql)
601597
php_info_print_table_start();
602598
php_info_print_table_row(2, "PostgreSQL Support", "enabled");
603599
php_info_print_table_row(2, "PostgreSQL (libpq) Version", pgsql_libpq_version);
604-
#ifdef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
605600
php_info_print_table_row(2, "Multibyte character support", "enabled");
606-
#else
607-
php_info_print_table_row(2, "Multibyte character support", "disabled");
608-
#endif
609601
snprintf(buf, sizeof(buf), ZEND_LONG_FMT, PGG(num_persistent));
610602
php_info_print_table_row(2, "Active Persistent Links", buf);
611603
snprintf(buf, sizeof(buf), ZEND_LONG_FMT, PGG(num_links));

ext/pgsql/php_pgsql.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ extern zend_module_entry pgsql_module_entry;
4848
# endif
4949
#endif
5050

51-
#ifdef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
52-
const char * pg_encoding_to_char(int encoding);
53-
#endif
54-
5551
PHP_MINIT_FUNCTION(pgsql);
5652
PHP_MSHUTDOWN_FUNCTION(pgsql);
5753
PHP_RINIT_FUNCTION(pgsql);

0 commit comments

Comments
 (0)