php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43214 PHP won't build with PostgreSQL < 7.4
Submitted: 2007-11-07 18:30 UTC Modified: 2010-04-21 03:21 UTC
From: koalay at gmail dot com Assigned: felipe (profile)
Status: Closed Package: PostgreSQL related
PHP Version: 5.2.4 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: koalay at gmail dot com
New email:
PHP Version: OS:

 

 [2007-11-07 18:30 UTC] koalay at gmail dot com
Description:
------------
I believe this is almost the same bug as Bug #33813.

PHP-5.2.4 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:
---------------
Build with --with-pgsql=[DIR]

Expected result:
----------------
It builds normally.

Actual result:
--------------
...
ext/pgsql/.libs/pgsql.o(.text+0x591a): In function `zif_pg_escape_bytea':
/var/software/LAMP/php-5.2.4/ext/pgsql/pgsql.c:3641: undefined reference to `PQfreemem'
ext/pgsql/.libs/pgsql.o(.text+0x599c): In function `zif_pg_unescape_bytea':
/var/software/LAMP/php-5.2.4/ext/pgsql/pgsql.c:3766: undefined reference to `PQfreemem'
ext/pgsql/.libs/pgsql.o(.text+0x6122): In function `zif_pg_get_notify':
/var/software/LAMP/php-5.2.4/ext/pgsql/pgsql.c:4379: undefined reference to `PQfreemem'
ext/pgsql/.libs/pgsql.o(.text+0x7daf): In function `php_pgsql_convert':
/var/software/LAMP/php-5.2.4/ext/pgsql/pgsql.c:5185: undefined reference to `PQfreemem'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

(error exit)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-11 18:50 UTC] jani@php.net
IIRC, this is fixed in 5.2.5 so please try it out.
 [2007-11-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-04-20 20:33 UTC] wdierkes at 5dollarwhitebox dot org
This is not resolved entirely.  As of 5.2.13 PHP will build against PQSQL < 7.4 but it does not function properly:

[wdierkes@esx02-bjd-el3-i386 wdierkes]$ php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_pgsql.so' - /usr/lib/php/modules/pdo_pgsql.so: undefined symbol: PQfreemem in Unknown on line 0
PHP 5.2.13 (cli) (built: Apr  8 2010 16:08:42) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies


RELATED:

http://bugs.php.net/search.php?search_for=pqfreemem&boolean=0&limit=30&order_by=&direction=DESC&cmd=display&status=All&bug_type=All&php_os=&phpver=&assign=&author_email=&bug_age=0&bug_updated=0


The issue was partially fixed in ext/pgsql/pgsql.c but the same fix was not applied to pdo_pgsql.  The following should resolve it:

--- php-5.2.13/ext/pdo_pgsql/pgsql_driver.c.orig        2010-01-12 06:46:54.000000000 -0600
+++ php-5.2.13/ext/pdo_pgsql/pgsql_driver.c     2010-04-20 13:23:09.000000000 -0500
@@ -40,6 +40,10 @@
 #include "php_pdo_pgsql_int.h"
 #include "zend_exceptions.h"
 
+#ifndef HAVE_PQFREEMEM
+#define PQfreemem free
+#endif
+
 static char * _pdo_pgsql_trim_message(const char *message, int persistent)
 {
        register int i = strlen(message)-1;
--- php-5.2.13/ext/pdo_pgsql/pgsql_statement.c.orig     2010-01-03 03:23:27.000000000 -0600
+++ php-5.2.13/ext/pdo_pgsql/pgsql_statement.c  2010-04-20 13:23:32.000000000 -0500
@@ -44,6 +44,10 @@
 #define TEXTOID     25
 #define OIDOID      26
 
+#ifndef HAVE_PQFREEMEM
+#define PQfreemem free
+#endif
+
 static int pgsql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
 {
        pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
 [2010-04-21 03:21 UTC] felipe@php.net
-Status: No Feedback +Status: Closed -Assigned To: +Assigned To: felipe
 [2010-04-21 03:21 UTC] felipe@php.net
This bug has been fixed in SVN.

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.

Fixed. (Bug #51617)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC