Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/workflows/test-phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,28 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4']
php: [ '8.2', '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4']
DB: [ 'pdo/mysql', 'pdo/pgsql', 'pdo/sqlite', 'mysqli', 'pgsql', 'sqlite' ]
compiler: [ default ]
include:
- php: '8.2'
DB: 'pdo/mysql'
compiler: jit
- php: '8.2'
DB: 'pdo/pgsql'
compiler: jit
- php: '8.2'
DB: 'pdo/sqlite'
compiler: jit
- php: '8.2'
DB: 'mysqli'
compiler: jit
- php: '8.2'
DB: 'pgsql'
compiler: jit
- php: '8.2'
DB: 'sqlite'
compiler: jit
- php: '8.1'
DB: 'pdo/mysql'
compiler: jit
Expand Down
3 changes: 2 additions & 1 deletion system/core/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,11 @@
*/
$URI =& load_class('URI', 'core', $CFG);

/*
/**
* ------------------------------------------------------
* Instantiate the routing class and set the routing
* ------------------------------------------------------
* @var CI_Router|NULL
*/
$RTR =& load_class('Router', 'core', isset($routing) ? $routing : NULL);

Expand Down
42 changes: 21 additions & 21 deletions system/core/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
/**
* Determines if the current version of PHP is equal to or greater than the supplied value
*
* @param string
* @param string $version
* @return bool TRUE if the current version is $version or higher
*/
function is_php($version)
Expand Down Expand Up @@ -85,7 +85,7 @@ function is_php($version)
* the file, based on the read-only attribute.
*
* @link https://bugs.php.net/bug.php?id=54709
* @param string
* @param string $file
* @return bool
*/
function is_really_writable($file)
Expand Down Expand Up @@ -133,9 +133,9 @@ function is_really_writable($file)
* exist it is instantiated and set to a static variable. If it has
* previously been instantiated the variable is returned.
*
* @param string the class name being requested
* @param string the directory where the class should be found
* @param mixed an optional argument to pass to the class constructor
* @param string $class the class name being requested
* @param string $directory the directory where the class should be found
* @param mixed $param an optional argument to pass to the class constructor
* @return object
*/
function &load_class($class, $directory = 'libraries', $param = NULL)
Expand Down Expand Up @@ -206,7 +206,7 @@ function &load_class($class, $directory = 'libraries', $param = NULL)
* Keeps track of which libraries have been loaded. This function is
* called by the load_class() function above
*
* @param string
* @param string $class
* @return array
*/
function &is_loaded($class = '')
Expand All @@ -232,7 +232,7 @@ function &is_loaded($class = '')
* This function lets us grab the config file even if the Config class
* hasn't been instantiated yet
*
* @param array
* @param array $replace
* @return array
*/
function &get_config(Array $replace = array())
Expand Down Expand Up @@ -287,7 +287,7 @@ function &get_config(Array $replace = array())
/**
* Returns the specified config item
*
* @param string
* @param string $item
* @return mixed
*/
function config_item($item)
Expand Down Expand Up @@ -395,9 +395,9 @@ function is_cli()
* This function will send the error page directly to the
* browser and exit.
*
* @param string
* @param int
* @param string
* @param string $message
* @param int $status_code
* @param string $heading
* @return void
*/
function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered')
Expand Down Expand Up @@ -430,8 +430,8 @@ function show_error($message, $status_code = 500, $heading = 'An Error Was Encou
* However, instead of the standard error template it displays
* 404 errors.
*
* @param string
* @param bool
* @param string $page
* @param bool $log_error
* @return void
*/
function show_404($page = '', $log_error = TRUE)
Expand All @@ -452,8 +452,8 @@ function show_404($page = '', $log_error = TRUE)
* We use this as a simple mechanism to access the logging
* class and send messages to be logged.
*
* @param string the error level: 'error', 'debug' or 'info'
* @param string the error message
* @param string $level the error level: 'error', 'debug' or 'info'
* @param string $message the error message
* @return void
*/
function log_message($level, $message)
Expand All @@ -477,8 +477,8 @@ function log_message($level, $message)
/**
* Set HTTP Status Header
*
* @param int the status code
* @param string
* @param int $code the status code
* @param string $text
* @return void
*/
function set_status_header($code = 200, $text = '')
Expand Down Expand Up @@ -706,8 +706,8 @@ function _shutdown_handler()
* This prevents sandwiching null characters
* between ascii characters, like Java\0script.
*
* @param string
* @param bool
* @param string $str
* @param bool $url_encoded
* @return string
*/
function remove_invisible_characters($str, $url_encoded = TRUE)
Expand Down Expand Up @@ -777,8 +777,8 @@ function html_escape($var, $double_encode = TRUE)
* Helper function used to convert a string, array, or object
* of attributes to a string.
*
* @param mixed string, array, object
* @param bool
* @param mixed $attributes string, array, object
* @param bool $js
* @return string
*/
function _stringify_attributes($attributes, $js = FALSE)
Expand Down
1 change: 1 addition & 0 deletions system/core/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
* @author EllisLab Dev Team
* @link https://codeigniter.com/userguide3/general/controllers.html
*/
#[AllowDynamicProperties]
class CI_Controller {

/**
Expand Down
7 changes: 4 additions & 3 deletions system/core/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
* @author EllisLab Dev Team
* @link https://codeigniter.com/userguide3/libraries/loader.html
*/
#[AllowDynamicProperties]
class CI_Loader {

// All these are set automatically. Don't mess with them.
Expand Down Expand Up @@ -443,7 +444,7 @@ class_exists('CI_DB', FALSE) OR $this->database();
/**
* Load the Database Forge Class
*
* @param object $db Database object
* @param CI_DB $db Database object
* @param bool $return Whether to return the DB Forge class object or not
* @return object
*/
Expand Down Expand Up @@ -685,7 +686,7 @@ public function helpers($helpers = array())
* Loads language files.
*
* @param string|string[] $files List of language file names to load
* @param string Language name
* @param string $lang Language name
* @return object
*/
public function language($files, $lang = '')
Expand Down Expand Up @@ -1424,7 +1425,7 @@ protected function _ci_prepare_view_vars($vars)
* Get a reference to a specific library or model.
*
* @param string $component Component name
* @return bool
* @return object
*/
protected function &_ci_get_component($component)
{
Expand Down
11 changes: 9 additions & 2 deletions system/core/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ class CI_Router {
*/
public $config;

/**
* CI_URI class object
*
* @var object
*/
public $uri;

/**
* List of routes
*
Expand All @@ -84,7 +91,7 @@ class CI_Router {
*
* @var string
*/
public $directory = '';
public $directory;

/**
* Default controller (and method if specific)
Expand Down Expand Up @@ -333,7 +340,7 @@ protected function _set_default_controller()
protected function _validate_request($segments)
{
$c = count($segments);
$directory_override = $this->directory !== '';
$directory_override = isset($this->directory);

// Loop through our segments and return as soon as a controller
// is found or when such a directory doesn't exist
Expand Down
2 changes: 1 addition & 1 deletion system/core/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ protected function _decode_entity($match)
* Do Never Allowed
*
* @used-by CI_Security::xss_clean()
* @param string
* @param string $str
* @return string
*/
protected function _do_never_allowed($str)
Expand Down
7 changes: 7 additions & 0 deletions system/core/URI.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
*/
class CI_URI {

/**
* CI_Config instance
*
* @var CI_Config
*/
public $config;

/**
* List of cached URI segments
*
Expand Down
37 changes: 22 additions & 15 deletions system/database/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@
*/
defined('BASEPATH') OR exit('No direct script access allowed');


// S. Imp moved this here from the conditional below because it
// accomplishes the same thing more efficiently while dramatically
// reducing the number of errors reported by phpstan
require_once(BASEPATH.'database/DB_driver.php');
require_once(BASEPATH.'database/DB_query_builder.php');
/**
* CI_DB
*
* Acts as an alias for both CI_DB_driver and CI_DB_query_builder.
*
* @see CI_DB_query_builder
* @see CI_DB_driver
*/
class CI_DB extends CI_DB_query_builder {}




/**
* Initialize the database
*
Expand Down Expand Up @@ -148,21 +167,6 @@ function &DB($params = '')
show_error('You have not selected a database type to connect to.');
}

require_once(BASEPATH.'database/DB_driver.php');
require_once(BASEPATH.'database/DB_query_builder.php');
if ( ! class_exists('CI_DB', FALSE))
{
/**
* CI_DB
*
* Acts as an alias for both CI_DB_driver and CI_DB_query_builder.
*
* @see CI_DB_query_builder
* @see CI_DB_driver
*/
class CI_DB extends CI_DB_query_builder {}
}

// Load the DB driver
$driver_file = BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php';
file_exists($driver_file) OR show_error('Invalid DB driver');
Expand All @@ -174,6 +178,9 @@ class CI_DB extends CI_DB_query_builder {}

// Instantiate the DB adapter
$driver = 'CI_DB_'.$params['dbdriver'].'_driver';
/**
* @var CI_DB_driver
*/
$DB = new $driver($params);

// Check for a subdriver
Expand Down
Loading