php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33813 PHP won't build with PostgreSQL < 7.4
Submitted: 2005-07-22 04:28 UTC Modified: 2005-08-16 11:55 UTC
From: dseg at shield dot jp Assigned: yohgaki (profile)
Status: Closed Package: Compile Failure
PHP Version: 5.1.0b3 OS: LINUX
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dseg at shield dot jp
New email:
PHP Version: OS:

 

 [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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-22 04:57 UTC] dseg at shield dot jp
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;
 	}
 [2005-08-16 11:55 UTC] edink@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 08:01:28 2024 UTC