|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-07-22 04:28 UTC] dseg at shield dot jp
Description: ------------ PHP-5.1.0b3 won't build with PostgreSQL < 7.4. The reason for this is that the ext/pgsql/pgsql.c use the PQfreemem function which is only available in PostgreSQL 7.4 or later. Reproduce code: --------------- configure --with-pgsql Expected result: ---------------- It should build Actual result: -------------- ext/pgsql/.libs/pgsql.o: In function `zif_pg_unescape_bytea': ext/pgsql/.libs/pgsql.o(.text+0x3c2c): undefined reference to `PQfreemem' collect2: ld returned 1 exit status make: *** [sapi/cli/php] Error 1 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 05:00:01 2025 UTC |
Patch for this bug: --- ext/pgsql/config.m4.orig 2005-05-30 08:16:43.000000000 +0900 +++ ext/pgsql/config.m4 2005-07-22 09:33:47.000000000 +0900 @@ -88,6 +88,7 @@ AC_CHECK_LIB(pq, PQputCopyEnd,AC_DEFINE(HAVE_PQPUTCOPYEND,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQgetCopyData,AC_DEFINE(HAVE_PQGETCOPYDATA,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQsetErrorVerbosity,AC_DEFINE(HAVE_PQSETERRORVERBOSITY,1,[PostgreSQL 7.4 or later])) + AC_CHECK_LIB(pq, PQfreemem,AC_DEFINE(HAVE_PQFREEMEM,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibyte])) LIBS=$old_LIBS LDFLAGS=$old_LDFLAGS --- ext/pgsql/pgsql.c.orig 2005-07-08 09:40:32.000000000 +0900 +++ ext/pgsql/pgsql.c 2005-07-21 13:21:52.000000000 +0900 @@ -3598,10 +3598,17 @@ #if HAVE_PQUNESCAPEBYTEA tmp = (char *)PQunescapeBytea((unsigned char*)from, &to_len); to = estrndup(tmp, to_len); - PQfreemem(tmp); #else to = (char *)php_pgsql_unescape_bytea((unsigned char*)from, &to_len); #endif + if(tmp) { +#if HAVE_PQFREEMEM + PQfreemem(tmp); +#else + efree(tmp); +#endif + } + if (!to) { RETURN_FALSE; }