summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2022-01-05 16:32:10 +0100
committerAndrey Andreev <narf@devilix.net>2022-01-05 16:32:10 +0100
commit2fa66ba7c6840ac851ae7da2889e7fb654dcda07 (patch)
tree70573048d629ecc51804507c7868356fad323860 /system
parentefc96b71e4b1d13d713d8b2be01796b7d30e6f9b (diff)
parent1d0315b6b3d7003bfb348ccaf7ee30d2533635de (diff)
Merge branch '3.1-stable' into develop
Diffstat (limited to 'system')
-rw-r--r--system/core/Common.php5
-rw-r--r--system/core/Input.php2
-rw-r--r--system/core/Log.php2
-rw-r--r--system/core/Output.php2
-rw-r--r--system/core/Security.php38
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php7
-rw-r--r--system/database/drivers/postgre/postgre_driver.php4
-rw-r--r--system/database/drivers/postgre/postgre_result.php2
-rw-r--r--system/libraries/Email.php2
-rw-r--r--system/libraries/Encryption.php12
-rw-r--r--system/libraries/Form_validation.php2
-rw-r--r--system/libraries/Ftp.php2
-rw-r--r--system/libraries/Session/CI_Session_driver_interface.php58
-rw-r--r--system/libraries/Session/OldSessionWrapper.php88
-rw-r--r--system/libraries/Session/PHP8SessionWrapper.php90
-rw-r--r--system/libraries/Session/Session.php24
-rw-r--r--system/libraries/Session/Session_driver.php5
-rw-r--r--system/libraries/Session/drivers/Session_database_driver.php5
-rw-r--r--system/libraries/Session/drivers/Session_files_driver.php7
-rw-r--r--system/libraries/Session/drivers/Session_memcached_driver.php5
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php5
-rw-r--r--system/libraries/Upload.php2
-rw-r--r--system/libraries/User_agent.php2
-rw-r--r--system/libraries/Xmlrpc.php2
-rw-r--r--system/libraries/Zip.php2
25 files changed, 328 insertions, 47 deletions
diff --git a/system/core/Common.php b/system/core/Common.php
index ed96de0ca..52cb7114e 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -782,11 +782,9 @@ if ( ! function_exists('_stringify_attributes'))
*/
function _stringify_attributes($attributes, $js = FALSE)
{
- $atts = NULL;
-
if (empty($attributes))
{
- return $atts;
+ return NULL;
}
if (is_string($attributes))
@@ -796,6 +794,7 @@ if ( ! function_exists('_stringify_attributes'))
$attributes = (array) $attributes;
+ $atts = '';
foreach ($attributes as $key => $val)
{
$atts .= ($js) ? $key.'='.$val.',' : ' '.$key.'="'.$val.'"';
diff --git a/system/core/Input.php b/system/core/Input.php
index 30d528b89..87e6cfed9 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -508,7 +508,7 @@ class CI_Input {
$which = FILTER_FLAG_IPV6;
break;
default:
- $which = NULL;
+ $which = 0;
break;
}
diff --git a/system/core/Log.php b/system/core/Log.php
index 36634c159..9c33f3e98 100644
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -122,7 +122,7 @@ class CI_Log {
{
$config =& get_config();
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
$this->_log_path = ($config['log_path'] !== '')
? rtrim($config['log_path'], '/\\').DIRECTORY_SEPARATOR : APPPATH.'logs'.DIRECTORY_SEPARATOR;
diff --git a/system/core/Output.php b/system/core/Output.php
index bbad9f168..7f153ef77 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -145,7 +145,7 @@ class CI_Output {
&& extension_loaded('zlib')
);
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
// Get mime types for later
$this->mimes =& get_mimes();
diff --git a/system/core/Security.php b/system/core/Security.php
index 818b09338..aac308194 100644
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -273,15 +273,35 @@ class CI_Security {
return FALSE;
}
- setcookie(
- $this->_csrf_cookie_name,
- $this->_csrf_hash,
- $expire,
- config_item('cookie_path'),
- config_item('cookie_domain'),
- $secure_cookie,
- config_item('cookie_httponly')
- );
+ if (is_php('7.3'))
+ {
+ setcookie(
+ $this->_csrf_cookie_name,
+ $this->_csrf_hash,
+ array(
+ 'expires' => $expire,
+ 'path' => config_item('cookie_path'),
+ 'domain' => config_item('cookie_domain'),
+ 'secure' => $secure_cookie,
+ 'httponly' => config_item('cookie_httponly'),
+ 'samesite' => 'Strict'
+ )
+ );
+ }
+ else
+ {
+ $domain = trim(config_item('cookie_domain'));
+ header('Set-Cookie: '.$this->_csrf_cookie_name.'='.$this->_csrf_hash
+ .'; Expires='.gmdate('D, d-M-Y H:i:s T', $expire)
+ .'; Max-Age='.$this->_csrf_expire
+ .'; Path='.rawurlencode(config_item('cookie_path'))
+ .($domain === '' ? '' : '; Domain='.$domain)
+ .($secure_cookie ? '; Secure' : '')
+ .(config_item('cookie_httponly') ? '; HttpOnly' : '')
+ .'; SameSite=Strict'
+ );
+ }
+
log_message('info', 'CSRF cookie sent');
return $this;
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 428b7e7f6..dc3d0cf48 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -116,6 +116,13 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
public function db_connect($persistent = FALSE)
{
+ // PHP 8.1 changes default error handling mode from silent to exceptions - reverse that
+ if (is_php('8.1'))
+ {
+ $mysqli_driver = new mysqli_driver();
+ $mysqli_driver->report_mode = MYSQLI_REPORT_OFF;
+ }
+
// Do we have a socket path?
if ($this->hostname[0] === '/')
{
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index af636e3f5..22638f901 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -135,7 +135,7 @@ class CI_DB_postgre_driver extends CI_DB {
* Database connection
*
* @param bool $persistent
- * @return resource
+ * @return resource|object
*/
public function db_connect($persistent = FALSE)
{
@@ -220,7 +220,7 @@ class CI_DB_postgre_driver extends CI_DB {
* Execute the query
*
* @param string $sql an SQL query
- * @return resource
+ * @return resource|object
*/
protected function _execute($sql)
{
diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php
index a0a628f0a..d977a60e3 100644
--- a/system/database/drivers/postgre/postgre_result.php
+++ b/system/database/drivers/postgre/postgre_result.php
@@ -126,7 +126,7 @@ class CI_DB_postgre_result extends CI_DB_result {
*/
public function free_result()
{
- if (is_resource($this->result_id))
+ if ($this->result_id !== FALSE)
{
pg_free_result($this->result_id);
$this->result_id = FALSE;
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 01f513b26..b01e44a63 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -389,7 +389,7 @@ class CI_Email {
$this->charset = config_item('charset');
$this->initialize($config);
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
log_message('info', 'Email Class Initialized');
}
diff --git a/system/libraries/Encryption.php b/system/libraries/Encryption.php
index b11588afd..7d648dfa3 100644
--- a/system/libraries/Encryption.php
+++ b/system/libraries/Encryption.php
@@ -161,7 +161,7 @@ class CI_Encryption {
show_error('Encryption: Unable to find an available encryption driver.');
}
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
$this->initialize($params);
if ( ! isset($this->_key) && self::strlen($key = config_item('encryption_key')) > 0)
@@ -476,7 +476,7 @@ class CI_Encryption {
$iv = ($iv_size = openssl_cipher_iv_length($params['handle']))
? $this->create_key($iv_size)
- : NULL;
+ : '';
$data = openssl_encrypt(
$data,
@@ -585,7 +585,7 @@ class CI_Encryption {
}
else
{
- $iv = NULL;
+ $iv = '';
}
if (mcrypt_generic_init($params['handle'], $params['key'], $iv) < 0)
@@ -632,7 +632,7 @@ class CI_Encryption {
}
else
{
- $iv = NULL;
+ $iv = '';
}
return empty($params['handle'])
@@ -910,8 +910,8 @@ class CI_Encryption {
protected static function strlen($str)
{
return (self::$func_overload)
- ? mb_strlen($str, '8bit')
- : strlen($str);
+ ? mb_strlen((string) $str, '8bit')
+ : strlen((string) $str);
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 32cdc6bd4..043a97c6d 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -1062,7 +1062,7 @@ class CI_Form_validation {
{
return is_array($str)
? (empty($str) === FALSE)
- : (trim($str) !== '');
+ : (trim((string) $str) !== '');
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php
index 61fa80c0f..92644153a 100644
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
@@ -202,7 +202,7 @@ class CI_FTP {
*/
protected function _is_conn()
{
- if ( ! is_resource($this->conn_id))
+ if ($this->conn_id !== FALSE)
{
if ($this->debug === TRUE)
{
diff --git a/system/libraries/Session/CI_Session_driver_interface.php b/system/libraries/Session/CI_Session_driver_interface.php
new file mode 100644
index 000000000..a854e92af
--- /dev/null
+++ b/system/libraries/Session/CI_Session_driver_interface.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP
+ *
+ * This content is released under the MIT License (MIT)
+ *
+ * Copyright (c) 2022, CodeIgniter Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * @package CodeIgniter
+ * @author EllisLab Dev Team
+ * @copyright Copyright (c) 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license http://opensource.org/licenses/MIT MIT License
+ * @link https://codeigniter.com
+ * @since Version 3.0.0
+ * @filesource
+ */
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+/**
+ * CI_Session_driver_interface
+ *
+ * A compatibility typeless SessionHandlerInterface alias
+ *
+ * @package CodeIgniter
+ * @subpackage Libraries
+ * @category Sessions
+ * @author Andrey Andreev
+ * @link https://codeigniter.com/userguide3/libraries/sessions.html
+ */
+interface CI_Session_driver_interface {
+
+ public function open($save_path, $name);
+ public function close();
+ public function read($session_id);
+ public function write($session_id, $session_data);
+ public function destroy($session_id);
+ public function gc($maxlifetime);
+}
diff --git a/system/libraries/Session/OldSessionWrapper.php b/system/libraries/Session/OldSessionWrapper.php
new file mode 100644
index 000000000..5934b5218
--- /dev/null
+++ b/system/libraries/Session/OldSessionWrapper.php
@@ -0,0 +1,88 @@
+<?php
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP
+ *
+ * This content is released under the MIT License (MIT)
+ *
+ * Copyright (c) 2022, CodeIgniter Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * @package CodeIgniter
+ * @author EllisLab Dev Team
+ * @copyright Copyright (c) 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license http://opensource.org/licenses/MIT MIT License
+ * @link https://codeigniter.com
+ * @since Version 3.0.0
+ * @filesource
+ */
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+/**
+ * OldSessionWrapper
+ *
+ * PHP 8 Session handler compatibility wrapper, pre-PHP8 version
+ *
+ * @package CodeIgniter
+ * @subpackage Libraries
+ * @category Sessions
+ * @author Andrey Andreev
+ * @link https://codeigniter.com/userguide3/libraries/sessions.html
+ */
+class CI_SessionWrapper implements SessionHandlerInterface {
+
+ protected CI_Session_driver_interface $driver;
+
+ public function __construct(CI_Session_driver_interface $driver)
+ {
+ $this->driver = $driver;
+ }
+
+ public function open($save_path, $name)
+ {
+ return $this->driver->open($save_path, $name);
+ }
+
+ public function close()
+ {
+ return $this->driver->close();
+ }
+
+ public function read($id)
+ {
+ return $this->driver->read($id);
+ }
+
+ public function write($id, $data)
+ {
+ return $this->driver->write($id, $data);
+ }
+
+ public function destroy($id)
+ {
+ return $this->driver->destroy($id);
+ }
+
+ public function gc($maxlifetime)
+ {
+ return $this->driver->gc($maxlifetime);
+ }
+}
diff --git a/system/libraries/Session/PHP8SessionWrapper.php b/system/libraries/Session/PHP8SessionWrapper.php
new file mode 100644
index 000000000..c6dfaf7e0
--- /dev/null
+++ b/system/libraries/Session/PHP8SessionWrapper.php
@@ -0,0 +1,90 @@
+<?php
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP
+ *
+ * This content is released under the MIT License (MIT)
+ *
+ * Copyright (c) 2022, CodeIgniter Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * @package CodeIgniter
+ * @author EllisLab Dev Team
+ * @copyright Copyright (c) 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license http://opensource.org/licenses/MIT MIT License
+ * @link https://codeigniter.com
+ * @since Version 3.0.0
+ * @filesource
+ */
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+/**
+ * PHP8SessionWrapper
+ *
+ * PHP 8 Session handler compatibility wrapper
+ *
+ * @package CodeIgniter
+ * @subpackage Libraries
+ * @category Sessions
+ * @author Andrey Andreev
+ * @link https://codeigniter.com/userguide3/libraries/sessions.html
+ */
+class CI_SessionWrapper implements SessionHandlerInterface {
+
+ protected CI_Session_driver_interface $driver;
+
+ public function __construct(CI_Session_driver_interface $driver)
+ {
+ $this->driver = $driver;
+ }
+
+ public function open(string $save_path, string $name): bool
+ {
+ return $this->driver->open($save_path, $name);
+ }
+
+ public function close(): bool
+ {
+ return $this->driver->close();
+ }
+
+ #[\ReturnTypeWillChange]
+ public function read(string $id): mixed
+ {
+ return $this->driver->read($id);
+ }
+
+ public function write(string $id, string $data): bool
+ {
+ return $this->driver->write($id, $data);
+ }
+
+ public function destroy(string $id): bool
+ {
+ return $this->driver->destroy($id);
+ }
+
+ #[\ReturnTypeWillChange]
+ public function gc(int $maxlifetime): mixed
+ {
+ return $this->driver->gc($maxlifetime);
+ }
+}
diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php
index 157a1d572..6479d7242 100644
--- a/system/libraries/Session/Session.php
+++ b/system/libraries/Session/Session.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 2.0.0
@@ -102,15 +103,24 @@ class CI_Session {
$this->_configure($params);
$this->_config['_sid_regexp'] = $this->_sid_regexp;
- $class = new $class($this->_config);
- if ($class instanceof SessionHandlerInterface)
+ $class = new $class($this->_config);
+ $wrapper = new CI_SessionWrapper($class);
+ if (is_php('5.4'))
{
session_set_save_handler($class, TRUE);
}
else
{
- log_message('error', "Session: Driver '".$this->_driver."' doesn't implement SessionHandlerInterface. Aborting.");
- return;
+ session_set_save_handler(
+ array($class, 'open'),
+ array($class, 'close'),
+ array($class, 'read'),
+ array($class, 'write'),
+ array($class, 'destroy'),
+ array($class, 'gc')
+ );
+
+ register_shutdown_function('session_write_close');
}
// Sanitize the cookie, because apparently PHP doesn't do that for userspace handlers
@@ -174,6 +184,10 @@ class CI_Session {
*/
protected function _ci_load_classes($driver)
{
+ require_once(BASEPATH.'libraries/Session/CI_Session_driver_interface.php');
+ $wrapper = is_php('8.0') ? 'PHP8SessionWrapper' : 'OldSessionWrapper';
+ require_once(BASEPATH.'libraries/Session/'.$wrapper.'.php');
+
$prefix = config_item('subclass_prefix');
if ( ! class_exists('CI_Session_driver', FALSE))
diff --git a/system/libraries/Session/Session_driver.php b/system/libraries/Session/Session_driver.php
index 734b6e052..d78492b5e 100644
--- a/system/libraries/Session/Session_driver.php
+++ b/system/libraries/Session/Session_driver.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 3.0.0
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @author Andrey Andreev
* @link https://codeigniter.com/userguide3/libraries/sessions.html
*/
-abstract class CI_Session_driver implements SessionHandlerInterface {
+abstract class CI_Session_driver {
protected $_config;
diff --git a/system/libraries/Session/drivers/Session_database_driver.php b/system/libraries/Session/drivers/Session_database_driver.php
index a3055af5e..2f788a1a1 100644
--- a/system/libraries/Session/drivers/Session_database_driver.php
+++ b/system/libraries/Session/drivers/Session_database_driver.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 3.0.0
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @author Andrey Andreev
* @link https://codeigniter.com/userguide3/libraries/sessions.html
*/
-class CI_Session_database_driver extends CI_Session_driver implements SessionHandlerInterface {
+class CI_Session_database_driver extends CI_Session_driver implements CI_Session_driver_interface {
/**
* DB object
diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php
index 49bf5b781..4b7b9878b 100644
--- a/system/libraries/Session/drivers/Session_files_driver.php
+++ b/system/libraries/Session/drivers/Session_files_driver.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 3.0.0
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @author Andrey Andreev
* @link https://codeigniter.com/userguide3/libraries/sessions.html
*/
-class CI_Session_files_driver extends CI_Session_driver implements SessionHandlerInterface {
+class CI_Session_files_driver extends CI_Session_driver implements CI_Session_driver_interface {
/**
* Save path
@@ -115,7 +116,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle
$this->_sid_regexp = $this->_config['_sid_regexp'];
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
}
// ------------------------------------------------------------------------
diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php
index b4d3eb464..d84a9df1d 100644
--- a/system/libraries/Session/drivers/Session_memcached_driver.php
+++ b/system/libraries/Session/drivers/Session_memcached_driver.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 3.0.0
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @author Andrey Andreev
* @link https://codeigniter.com/userguide3/libraries/sessions.html
*/
-class CI_Session_memcached_driver extends CI_Session_driver implements SessionHandlerInterface {
+class CI_Session_memcached_driver extends CI_Session_driver implements CI_Session_driver_interface {
/**
* Memcached instance
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index df99cc74a..fae024bee 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 3.0.0
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @author Andrey Andreev
* @link https://codeigniter.com/userguide3/libraries/sessions.html
*/
-class CI_Session_redis_driver extends CI_Session_driver implements SessionHandlerInterface {
+class CI_Session_redis_driver extends CI_Session_driver implements CI_Session_driver_interface {
/**
* phpRedis instance
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 8d13e440e..281ebef1a 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -1227,7 +1227,7 @@ class CI_Upload {
if (function_exists('finfo_file'))
{
$finfo = @finfo_open(FILEINFO_MIME);
- if (is_resource($finfo)) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system
+ if ($finfo !== FALSE) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system
{
$mime = @finfo_file($finfo, $file['tmp_name']);
finfo_close($finfo);
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index a42975b35..c144db7a8 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -498,7 +498,7 @@ class CI_User_agent {
else
{
$referer_host = @parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
- $own_host = parse_url(config_item('base_url'), PHP_URL_HOST);
+ $own_host = parse_url((string) config_item('base_url'), PHP_URL_HOST);
$this->referer = ($referer_host && $referer_host !== $own_host);
}
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index fbb9a28a0..11d4400fe 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -1912,7 +1912,7 @@ class XML_RPC_Values extends CI_Xmlrpc
*/
public function iso8601_encode($time, $utc = FALSE)
{
- return ($utc) ? strftime('%Y%m%dT%H:%i:%s', $time) : gmstrftime('%Y%m%dT%H:%i:%s', $time);
+ return ($utc) ? date('Ymd\TH:i:s', $time) : gmdate('Ymd\TH:i:s', $time);
}
} // END XML_RPC_Values Class
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php
index b54d695d6..f744493a9 100644
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
@@ -119,7 +119,7 @@ class CI_Zip {
*/
public function __construct()
{
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
$this->now = time();
log_message('info', 'Zip Compression Class Initialized');