Skip to content

Commit d81f9d8

Browse files
committed
Remove conditional pg_encoding_to_char usage
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 dcd20da commit d81f9d8

File tree

4 files changed

+1
-15
lines changed

4 files changed

+1
-15
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_PQFREEMEM /D HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT" + (X64 ? " /D HAVE_PG_LO64" : "") + " ");
10+
ADD_FLAG("CFLAGS_PGSQL", "/D PGSQL_EXPORTS /D HAVE_PQFREEMEM" + (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 & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,6 @@ static void pgsql_lob_free_obj(zend_object *obj)
282282

283283
/* Compatibility definitions */
284284

285-
#ifndef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
286-
#define pg_encoding_to_char(x) "SQL_ASCII"
287-
#endif
288-
289285
static zend_string *_php_pgsql_trim_message(const char *message)
290286
{
291287
size_t i = strlen(message);
@@ -605,11 +601,6 @@ PHP_MINFO_FUNCTION(pgsql)
605601
php_info_print_table_start();
606602
php_info_print_table_row(2, "PostgreSQL Support", "enabled");
607603
php_info_print_table_row(2, "PostgreSQL (libpq) Version", pgsql_libpq_version);
608-
#ifdef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
609-
php_info_print_table_row(2, "Multibyte character support", "enabled");
610-
#else
611-
php_info_print_table_row(2, "Multibyte character support", "disabled");
612-
#endif
613604
snprintf(buf, sizeof(buf), ZEND_LONG_FMT, PGG(num_persistent));
614605
php_info_print_table_row(2, "Active Persistent Links", buf);
615606
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)