Skip to content

Commit

Permalink
[ci skip] Fix 5423
Browse files Browse the repository at this point in the history
  • Loading branch information
narfbg committed Feb 28, 2018
1 parent 8476056 commit 2f1fc71
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions system/database/drivers/postgre/postgre_driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ public function version()
* and so we'll have to fall back to running a query in
* order to get it.
*/
return isset($pg_version['server'])
? $this->data_cache['version'] = $pg_version['server']
return (isset($pg_version['server']) && preg_match('#^(\d+\.\d+)#', $pg_version['server'], $match))
? $this->data_cache['version'] = $match[1]
: parent::version();
}

Expand Down Expand Up @@ -354,8 +354,7 @@ public function affected_rows()
*/
public function insert_id()
{
$v = pg_version($this->conn_id);
$v = isset($v['server']) ? $v['server'] : 0; // 'server' key is only available since PosgreSQL 7.4
$v = $this->version();

$table = (func_num_args() > 0) ? func_get_arg(0) : NULL;
$column = (func_num_args() > 1) ? func_get_arg(1) : NULL;
Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ Release Date: Not Released
- General Changes

- Updated :doc:`Email Library <libraries/email>` to always negotiate between TLS 1.0, 1.1, 1.2 when possible (PHP 5.6+) for SMTP connections.
- Updated :doc:`Database Library <database/index>` method ``version()`` to exclude suffixes to the main version numbers with the 'postgre' driver.

Bug fixes for 3.1.8
-------------------

- Fixed a bug where :doc:`Form Validation Library <libraries/form_validation>`, :doc:`Email Library <libraries/email>` tried to use ``INTL_IDNA_VARIANT_UTS46`` when it was undeclared.
- Fixed a bug where :doc:`Query Builder <database/query_builder>` methods ``where()``, ``having()`` treated values passed to them as arbitrary SQL.
- Fixed a bug (#5423) - :doc:`Database Library <database/index>` method ``insert_id()`` failed due to incorrect server version parsing with the 'postgre' driver.

Version 3.1.7
=============
Expand Down

0 comments on commit 2f1fc71

Please sign in to comment.