diff options
author | Andrey Andreev <narf@devilix.net> | 2018-02-28 21:33:36 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2018-02-28 21:33:36 +0100 |
commit | 2f1fc71c61ee9c781949d525f27fa1d5f11b9a95 (patch) | |
tree | e01ca0dcc95fb3efbf786ffb7b3b344320819c99 | |
parent | 84760562d5bb875af0a33b0d0f636dc3081db7c0 (diff) |
[ci skip] Fix 5423
-rw-r--r-- | system/database/drivers/postgre/postgre_driver.php | 7 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 7fb258abb..5779c8783 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -224,8 +224,8 @@ class CI_DB_postgre_driver extends CI_DB { * 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(); } @@ -354,8 +354,7 @@ class CI_DB_postgre_driver extends CI_DB { */ 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; diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 2b82d7b36..37291e196 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -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 ============= |