Skip to content

Commit d310726

Browse files
committed
Fixes a few more PHP 8.4 compatibility issues.
1 parent 8311086 commit d310726

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

system/core/Exceptions.php

+15-12
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,25 @@ class CI_Exceptions {
6262
* @var array
6363
*/
6464
public $levels = array(
65-
E_ERROR => 'Error',
66-
E_WARNING => 'Warning',
67-
E_PARSE => 'Parsing Error',
68-
E_NOTICE => 'Notice',
69-
E_CORE_ERROR => 'Core Error',
70-
E_CORE_WARNING => 'Core Warning',
71-
E_COMPILE_ERROR => 'Compile Error',
72-
E_COMPILE_WARNING => 'Compile Warning',
73-
E_USER_ERROR => 'User Error',
74-
E_USER_WARNING => 'User Warning',
75-
E_USER_NOTICE => 'User Notice',
65+
E_ERROR => 'Error',
66+
E_RECOVERABLE_ERROR => 'Recoverable Error',
67+
E_WARNING => 'Warning',
68+
E_PARSE => 'Parsing Error',
69+
E_NOTICE => 'Notice',
70+
E_DEPRECATED => 'Deprecated Notice',
71+
E_CORE_ERROR => 'Core Error',
72+
E_CORE_WARNING => 'Core Warning',
73+
E_COMPILE_ERROR => 'Compile Error',
74+
E_COMPILE_WARNING => 'Compile Warning',
75+
E_USER_ERROR => 'User Error',
76+
E_USER_WARNING => 'User Warning',
77+
E_USER_NOTICE => 'User Notice',
78+
E_USER_DEPRECATED => 'User Deprecated Notice',
7679

7780
# 2048 is E_STRICT, but it's deprecated in PHP 8.4.
7881
# We're keeping this here for backwards compatibility.
7982
# If we're on older PHP, E_STRICT errors will be labelled correctly, and if we're on PHP 8.4+, this will be ignored.
80-
2048 => 'Runtime Notice'
83+
2048 => 'Strict Notice',
8184
);
8285

8386
/**

system/libraries/Encryption.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,10 @@ public function create_key($length)
366366
* Encrypt
367367
*
368368
* @param string $data Input data
369-
* @param array $params Input parameters
369+
* @param array|null $params Input parameters
370370
* @return string
371371
*/
372-
public function encrypt($data, array $params = NULL)
372+
public function encrypt($data, $params = NULL)
373373
{
374374
if (($params = $this->_get_params($params)) === FALSE)
375375
{
@@ -501,10 +501,10 @@ protected function _openssl_encrypt($data, $params)
501501
* Decrypt
502502
*
503503
* @param string $data Encrypted data
504-
* @param array $params Input parameters
504+
* @param array|null $params Input parameters
505505
* @return string
506506
*/
507-
public function decrypt($data, array $params = NULL)
507+
public function decrypt($data, $params = NULL)
508508
{
509509
if (($params = $this->_get_params($params)) === FALSE)
510510
{

system/libraries/Session/Session.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ protected function _configure_sid_length()
417417
{
418418
$bits_per_character = (int) ini_get('session.sid_bits_per_character');
419419
$sid_length = (int) ini_get('session.sid_length');
420-
if (($bits = $sid_length * $bits_per_character) < 160)
420+
if (($bits = $sid_length * $bits_per_character) < 160 && version_compare(PHP_VERSION, '8.4', '<'))
421421
{
422422
// Add as many more characters as necessary to reach at least 160 bits
423423
$sid_length += (int) ceil((160 % $bits) / $bits_per_character);

0 commit comments

Comments
 (0)