CodeIgniter 3.1.11 -> 3.4.5 (pocketarc fork) en PHP 8.3-fixes
- system/ vervangen door CodeIgniter 3.4.5 (pocketarc/codeigniter, PHP 8.2-8.5 compatibel) - config.php, mimes.php, user_agents.php en error-views bijgewerkt naar 3.4.5 - composer.json: php-constraint "^7.4 || ^8.0" zodat composer install op 8.3 werkt - PHP 8-fatals opgelost: count()/array-functies op FALSE/null, rekenen met lege strings, delen door nul, property zetten op FALSE, curly-brace string offsets, ongedefinieerde constanten, foute curl_setopt in Phantom_model::create_img - dynamic properties gedeclareerd in libraries, optionele parameters voor verplichte opgelost - vergelijkingen waar '' == 0 in PHP 8 anders uitvalt gecast naar (int) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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 1.0.0
|
||||
@@ -48,8 +49,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
#[AllowDynamicProperties]
|
||||
abstract class CI_DB_driver {
|
||||
|
||||
/**
|
||||
@@ -380,7 +382,8 @@ abstract class CI_DB_driver {
|
||||
/**
|
||||
* Initialize Database Settings
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
* @throws RuntimeException In case of failure
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
@@ -392,7 +395,7 @@ abstract class CI_DB_driver {
|
||||
*/
|
||||
if ($this->conn_id)
|
||||
{
|
||||
return TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
@@ -429,19 +432,9 @@ abstract class CI_DB_driver {
|
||||
// We still don't have a connection?
|
||||
if ( ! $this->conn_id)
|
||||
{
|
||||
log_message('error', 'Unable to connect to the database');
|
||||
|
||||
if ($this->db_debug)
|
||||
{
|
||||
$this->display_error('db_unable_to_connect');
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
throw new RuntimeException('Unable to connect to the database.');
|
||||
}
|
||||
}
|
||||
|
||||
// Now we set the character set and that's all
|
||||
return $this->db_set_charset($this->char_set);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -516,31 +509,6 @@ abstract class CI_DB_driver {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set client character set
|
||||
*
|
||||
* @param string
|
||||
* @return bool
|
||||
*/
|
||||
public function db_set_charset($charset)
|
||||
{
|
||||
if (method_exists($this, '_db_set_charset') && ! $this->_db_set_charset($charset))
|
||||
{
|
||||
log_message('error', 'Unable to set database connection charset: '.$charset);
|
||||
|
||||
if ($this->db_debug)
|
||||
{
|
||||
$this->display_error('db_unable_to_set_charset', $charset);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The name of the platform in use (mysql, mssql, etc...)
|
||||
*
|
||||
@@ -634,7 +602,6 @@ abstract class CI_DB_driver {
|
||||
// cached query if it exists
|
||||
if ($this->cache_on === TRUE && $return_object === TRUE && $this->_cache_init())
|
||||
{
|
||||
$this->load_rdriver();
|
||||
if (FALSE !== ($cache = $this->CACHE->read($sql)))
|
||||
{
|
||||
return $cache;
|
||||
@@ -718,9 +685,9 @@ abstract class CI_DB_driver {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Load and instantiate the result driver
|
||||
$driver = $this->load_rdriver();
|
||||
$RES = new $driver($this);
|
||||
// Instantiate the driver-specific result class
|
||||
$driver = 'CI_DB_'.$this->dbdriver.'_result';
|
||||
$RES = new $driver($this);
|
||||
|
||||
// Is query caching enabled? If so, we'll serialize the
|
||||
// result object and save it to a cache file.
|
||||
@@ -749,26 +716,6 @@ abstract class CI_DB_driver {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Load the result drivers
|
||||
*
|
||||
* @return string the name of the result class
|
||||
*/
|
||||
public function load_rdriver()
|
||||
{
|
||||
$driver = 'CI_DB_'.$this->dbdriver.'_result';
|
||||
|
||||
if ( ! class_exists($driver, FALSE))
|
||||
{
|
||||
require_once(BASEPATH.'database/DB_result.php');
|
||||
require_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result.php');
|
||||
}
|
||||
|
||||
return $driver;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Simple Query
|
||||
* This is a simplified version of the query() function. Internally
|
||||
@@ -780,14 +727,7 @@ abstract class CI_DB_driver {
|
||||
*/
|
||||
public function simple_query($sql)
|
||||
{
|
||||
if ( ! $this->conn_id)
|
||||
{
|
||||
if ( ! $this->initialize())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
empty($this->conn_id) && $this->initialize();
|
||||
return $this->_execute($sql);
|
||||
}
|
||||
|
||||
@@ -890,6 +830,18 @@ abstract class CI_DB_driver {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns TRUE if a transaction is currently active
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_active()
|
||||
{
|
||||
return (bool) $this->_trans_depth;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
@@ -1377,10 +1329,11 @@ abstract class CI_DB_driver {
|
||||
*
|
||||
* This function escapes column and table names
|
||||
*
|
||||
* @param mixed
|
||||
* @param mixed $item Identifier to escape
|
||||
* @param bool $split Whether to split identifiers when a dot is encountered
|
||||
* @return mixed
|
||||
*/
|
||||
public function escape_identifiers($item)
|
||||
public function escape_identifiers($item, $split = TRUE)
|
||||
{
|
||||
if ($this->_escape_char === '' OR empty($item) OR in_array($item, $this->_reserved_identifiers))
|
||||
{
|
||||
@@ -1396,27 +1349,27 @@ abstract class CI_DB_driver {
|
||||
return $item;
|
||||
}
|
||||
// Avoid breaking functions and literal values inside queries
|
||||
elseif (ctype_digit($item) OR $item[0] === "'" OR ($this->_escape_char !== '"' && $item[0] === '"') OR strpos($item, '(') !== FALSE)
|
||||
elseif (ctype_digit((string) $item) OR $item[0] === "'" OR ($this->_escape_char !== '"' && $item[0] === '"') OR strpos($item, '(') !== FALSE)
|
||||
{
|
||||
return $item;
|
||||
}
|
||||
|
||||
static $preg_ec = array();
|
||||
static $preg_ec;
|
||||
|
||||
if (empty($preg_ec))
|
||||
{
|
||||
if (is_array($this->_escape_char))
|
||||
{
|
||||
$preg_ec = array(
|
||||
preg_quote($this->_escape_char[0], '/'),
|
||||
preg_quote($this->_escape_char[1], '/'),
|
||||
preg_quote($this->_escape_char[0]),
|
||||
preg_quote($this->_escape_char[1]),
|
||||
$this->_escape_char[0],
|
||||
$this->_escape_char[1]
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$preg_ec[0] = $preg_ec[1] = preg_quote($this->_escape_char, '/');
|
||||
$preg_ec[0] = $preg_ec[1] = preg_quote($this->_escape_char);
|
||||
$preg_ec[2] = $preg_ec[3] = $this->_escape_char;
|
||||
}
|
||||
}
|
||||
@@ -1425,11 +1378,13 @@ abstract class CI_DB_driver {
|
||||
{
|
||||
if (strpos($item, '.'.$id) !== FALSE)
|
||||
{
|
||||
return preg_replace('/'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?\./i', $preg_ec[2].'$1'.$preg_ec[3].'.', $item);
|
||||
return preg_replace('#'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?\.#i', $preg_ec[2].'$1'.$preg_ec[3].'.', $item);
|
||||
}
|
||||
}
|
||||
|
||||
return preg_replace('/'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?(\.)?/i', $preg_ec[2].'$1'.$preg_ec[3].'$2', $item);
|
||||
$dot = ($split !== FALSE) ? '\.' : '';
|
||||
|
||||
return preg_replace('#'.$preg_ec[0].'?([^'.$preg_ec[1].$dot.']+)'.$preg_ec[1].'?(\.)?#i', $preg_ec[2].'$1'.$preg_ec[3].'$2', $item);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -1564,6 +1519,7 @@ abstract class CI_DB_driver {
|
||||
'\s+EXISTS\s*\(.*\)', // EXISTS(sql)
|
||||
'\s+NOT EXISTS\s*\(.*\)', // NOT EXISTS(sql)
|
||||
'\s+BETWEEN\s+', // BETWEEN value AND value
|
||||
'\s+NOT BETWEEN\s+', // NOT BETWEEN value AND value
|
||||
'\s+IN\s*\(.*\)', // IN(list)
|
||||
'\s+NOT IN\s*\(.*\)', // NOT IN (list)
|
||||
'\s+LIKE\s+\S.*('.$_les.')?', // LIKE 'expr'[ ESCAPE '%s']
|
||||
@@ -1843,14 +1799,14 @@ abstract class CI_DB_driver {
|
||||
if ($offset = strripos($item, ' AS '))
|
||||
{
|
||||
$alias = ($protect_identifiers)
|
||||
? substr($item, $offset, 4).$this->escape_identifiers(substr($item, $offset + 4))
|
||||
? substr($item, $offset, 4).$this->escape_identifiers(substr($item, $offset + 4), FALSE)
|
||||
: substr($item, $offset);
|
||||
$item = substr($item, 0, $offset);
|
||||
}
|
||||
elseif ($offset = strrpos($item, ' '))
|
||||
{
|
||||
$alias = ($protect_identifiers)
|
||||
? ' '.$this->escape_identifiers(substr($item, $offset + 1))
|
||||
? ' '.$this->escape_identifiers(substr($item, $offset + 1), FALSE)
|
||||
: substr($item, $offset);
|
||||
$item = substr($item, 0, $offset);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user