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.3.0
|
||||
@@ -48,7 +49,7 @@ 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/
|
||||
*/
|
||||
class CI_DB_postgre_driver extends CI_DB {
|
||||
|
||||
@@ -78,22 +79,12 @@ class CI_DB_postgre_driver extends CI_DB {
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
* Build DSN
|
||||
*
|
||||
* Creates a DSN string to be used for db_connect() and db_pconnect()
|
||||
*
|
||||
* @param array $params
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($params)
|
||||
protected function _build_dsn()
|
||||
{
|
||||
parent::__construct($params);
|
||||
|
||||
if ( ! empty($this->dsn))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->dsn === '' OR $this->dsn = '';
|
||||
|
||||
if (strpos($this->hostname, '/') !== FALSE)
|
||||
@@ -104,7 +95,7 @@ class CI_DB_postgre_driver extends CI_DB {
|
||||
|
||||
$this->hostname === '' OR $this->dsn = 'host='.$this->hostname.' ';
|
||||
|
||||
if ( ! empty($this->port) && ctype_digit($this->port))
|
||||
if ( ! empty($this->port) && ctype_digit((string) $this->port))
|
||||
{
|
||||
$this->dsn .= 'port='.$this->port.' ';
|
||||
}
|
||||
@@ -145,10 +136,11 @@ class CI_DB_postgre_driver extends CI_DB {
|
||||
* Database connection
|
||||
*
|
||||
* @param bool $persistent
|
||||
* @return resource
|
||||
* @return resource|object
|
||||
*/
|
||||
public function db_connect($persistent = FALSE)
|
||||
{
|
||||
empty($this->dsn) && $this->_build_dsn();
|
||||
$this->conn_id = ($persistent === TRUE)
|
||||
? pg_pconnect($this->dsn)
|
||||
: pg_connect($this->dsn);
|
||||
@@ -163,6 +155,13 @@ class CI_DB_postgre_driver extends CI_DB {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pg_set_client_encoding($this->conn_id, $this->char_set) !== 0)
|
||||
{
|
||||
log_message('error', "Database: Unable to set the configured connection charset ('{$this->char_set}').");
|
||||
pg_close($this->conn_id);
|
||||
return ($this->db->db_debug) ? $this->display_error('db_unable_to_set_charset', $this->char_set) : FALSE;
|
||||
}
|
||||
|
||||
empty($this->schema) OR $this->simple_query('SET search_path TO '.$this->schema.',public');
|
||||
}
|
||||
|
||||
@@ -189,19 +188,6 @@ class CI_DB_postgre_driver extends CI_DB {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set client character set
|
||||
*
|
||||
* @param string $charset
|
||||
* @return bool
|
||||
*/
|
||||
protected function _db_set_charset($charset)
|
||||
{
|
||||
return (pg_set_client_encoding($this->conn_id, $charset) === 0);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Database version number
|
||||
*
|
||||
@@ -235,7 +221,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)
|
||||
{
|
||||
@@ -321,7 +307,7 @@ class CI_DB_postgre_driver extends CI_DB {
|
||||
*/
|
||||
public function escape($str)
|
||||
{
|
||||
if (is_php('5.4.4') && (is_string($str) OR (is_object($str) && method_exists($str, '__toString'))))
|
||||
if (is_string($str) OR (is_object($str) && method_exists($str, '__toString')))
|
||||
{
|
||||
return pg_escape_literal($this->conn_id, $str);
|
||||
}
|
||||
@@ -428,7 +414,7 @@ class CI_DB_postgre_driver extends CI_DB {
|
||||
{
|
||||
return 'SELECT "column_name"
|
||||
FROM "information_schema"."columns"
|
||||
WHERE LOWER("table_name") = '.$this->escape(strtolower($table));
|
||||
WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -443,7 +429,7 @@ class CI_DB_postgre_driver extends CI_DB {
|
||||
{
|
||||
$sql = 'SELECT "column_name", "data_type", "character_maximum_length", "numeric_precision", "column_default"
|
||||
FROM "information_schema"."columns"
|
||||
WHERE LOWER("table_name") = '.$this->escape(strtolower($table));
|
||||
WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table));
|
||||
|
||||
if (($query = $this->query($sql)) === FALSE)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user