From: Tim Starling Date: Mon, 11 May 2009 11:35:52 +0000 (+0000) Subject: Proposed fix for bug 16937: pg_version() missing server version due to PHP bug. X-Git-Tag: 1.31.0-rc.0~41823 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=1caee6915bd21a1e5c4b06763872da8776b6cd33;p=lhc%2Fweb%2Fwiklou.git Proposed fix for bug 16937: pg_version() missing server version due to PHP bug. --- diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index bc16bdbc56..c940ad095f 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -1076,12 +1076,15 @@ class DatabasePostgres extends Database { */ function getServerVersion() { $versionInfo = pg_version( $this->mConn ); - if ( isset( $versionInfo['server'] ) ) { + if ( version_compare( $versionInfo['client'], '7.4.0', 'lt' ) ) { + // Old client, abort install + $this->numeric_version = '7.3 or earlier'; + } elseif ( isset( $versionInfo['server'] ) ) { + // Normal client $this->numeric_version = $versionInfo['server']; } else { - // There's no way to identify the precise version before 7.4, but - // it doesn't matter anyway since we're just going to give an error. - $this->numeric_version = '7.3 or earlier'; + // Bug 16937: broken pgsql extension from PHP<5.3 + $this->numeric_version = pg_parameter_status( $this->mConn, 'server_version' ); } return $this->numeric_version; }