From af8cbdeed7b43951301e906bf73cabd948a9299a Mon Sep 17 00:00:00 2001 From: sapics Date: Sat, 16 Jan 2021 16:10:19 +0900 Subject: Fix error in core/Output.php for php8.0 Fix error in array_shift array_map('array_shift', $this->headers) causes error as array_shift(): Argument bcit-ci#1 ($array) must be passed by reference, value given --- system/core/Output.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/core/Output.php b/system/core/Output.php index c56aff4b0..02c6d151b 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -300,9 +300,13 @@ class CI_Output { public function get_header($header) { // Combine headers already sent with our batched headers + $headers = array(); + foreach ($this->headers as $value) + { + $headers[] = $value[0]; + } $headers = array_merge( - // We only need [x][0] from our multi-dimensional array - array_map('array_shift', $this->headers), + $headers, headers_list() ); -- cgit v1.2.3-24-g4f1b From 624ddad97028087ee4d61ab90827b944a192f65e Mon Sep 17 00:00:00 2001 From: sapics Date: Sat, 16 Jan 2021 16:10:57 +0900 Subject: Fix error in pdo/pgsql for php8.0 From PHP8.0, default PDO::ATTR_ERRMODE is changed from PDO::ERRMODE_SILENT to PDO::ERRMODE_EXCEPTION. Reference: https://wiki.php.net/rfc/pdo_default_errmode --- system/database/DB_driver.php | 2 +- system/database/drivers/pdo/pdo_driver.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'system') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index cba96d9a2..a213d5cba 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -825,7 +825,7 @@ abstract class CI_DB_driver { { return $this->_trans_status; } - + // -------------------------------------------------------------------- /** diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index d0a2bf959..b2178b684 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -131,6 +131,14 @@ class CI_DB_pdo_driver extends CI_DB { $this->options[PDO::ATTR_PERSISTENT] = TRUE; } + // From PHP8.0, default PDO::ATTR_ERRMODE is changed + // from PDO::ERRMODE_SILENT to PDO::ERRMODE_EXCEPTION + // as https://wiki.php.net/rfc/pdo_default_errmode + if ( ! isset($this->options[PDO::ATTR_ERRMODE])) + { + $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT; + } + try { return new PDO($this->dsn, $this->username, $this->password, $this->options); -- cgit v1.2.3-24-g4f1b From 9f6925398097a4f655827dc4030c82d435e27ae8 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Sun, 26 Sep 2021 23:56:39 +0300 Subject: Adds PHP 8 in Travis --- system/core/Output.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/core/Output.php b/system/core/Output.php index c56aff4b0..a2397763d 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -299,10 +299,15 @@ class CI_Output { */ public function get_header($header) { + // We only need [x][0] from our multi-dimensional array + $header_lines = array_map(function ($headers) + { + return array_shift($headers); + }, $this->headers); + // Combine headers already sent with our batched headers $headers = array_merge( - // We only need [x][0] from our multi-dimensional array - array_map('array_shift', $this->headers), + $header_lines, headers_list() ); -- cgit v1.2.3-24-g4f1b From bd5fab166ccff8c0bae963cd9d83a65c226cefa2 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Mon, 4 Oct 2021 19:40:47 +0300 Subject: Fixes CREATE TABLE IF NOT EXISTS on pdo_pgsql_forge; checking for dummy data DB operations result returns --- system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'system') diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php index 187cb2d09..4c3a5aaea 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php @@ -53,6 +53,13 @@ class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge { */ protected $_drop_table_if = 'DROP TABLE IF EXISTS'; + /** + * CREATE TABLE IF statement + * + * @var string + */ + protected $_create_table_if = 'CREATE TABLE IF NOT EXISTS'; + /** * UNSIGNED support * -- cgit v1.2.3-24-g4f1b