Skip to content

Remove conditional pg_encoding_to_char usage #14557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ext/pgsql/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down
2 changes: 1 addition & 1 deletion ext/pgsql/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 0 additions & 8 deletions ext/pgsql/pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down
4 changes: 0 additions & 4 deletions ext/pgsql/php_pgsql.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading