upgrade Codeigniter4.6.1

This commit is contained in:
Markus 2025-05-18 11:24:33 +02:00
parent 8f28ed82da
commit aedd66202a
37 changed files with 255 additions and 225 deletions

View File

@ -4,12 +4,12 @@
* The goal of this file is to allow developers a location * The goal of this file is to allow developers a location
* where they can overwrite core procedural functions and * where they can overwrite core procedural functions and
* replace them with their own. This file is loaded during * replace them with their own. This file is loaded during
* the bootstrap process and is called during the frameworks * the bootstrap process and is called during the framework's
* execution. * execution.
* *
* This can be looked at as a `master helper` file that is * This can be looked at as a `master helper` file that is
* loaded early on, and may also contain additional functions * loaded early on, and may also contain additional functions
* that you'd like to use throughout your entire application * that you'd like to use throughout your entire application
* *
* @see: https://codeigniter4.github.io/CodeIgniter4/ * @see: https://codeigniter.com/user_guide/extending/common.html
*/ */

View File

@ -11,21 +11,16 @@ class App extends BaseConfig
* Base Site URL * Base Site URL
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* *
* URL to your CodeIgniter root. Typically this will be your base URL, * URL to your CodeIgniter root. Typically, this will be your base URL,
* WITH a trailing slash: * WITH a trailing slash:
* *
* http://example.com/ * E.g., http://example.com/
*
* If this is not set then CodeIgniter will try guess the protocol, domain
* and path to your installation. However, you should always configure this
* explicitly and never rely on auto-guessing, especially in production
* environments.
*/ */
public string $baseURL = 'https://finanzen.mawim.at'; public string $baseURL = 'https://finanzen.mawim.at';
//public $nodeRedUrl = 'https://mqtt.mawim.at/api/'; //public $nodeRedUrl = 'https://mqtt.mawim.at/api/';
public string $nodeRedUrl = 'http://localhost:1880/api/'; public string $nodeRedUrl = 'http://localhost:1880/api/';
public string $speedTestUrl = 'http://mqtt.mawim.at:3000/d/qsjZJaYVz/ping-results?orgId=1&from=now-2d&to=now&var-client=nextcloud&kiosk'; public string $speedTestUrl = 'http://mqtt.mawim.at:3000/d/qsjZJaYVz/ping-results?orgId=1&from=now-2d&to=now&var-client=nextcloud&kiosk';
public string $spritPreisUrl = 'http://mqtt.mawim.at:3000/d/b1fce188-593b-4629-9a73-6bd11c2998bd/spritpreis?orgId=1&viewPanel=1&from=now-7d&to=now&kiosk'; public string $spritPreisUrl = 'https://mqtt.mawim.at/mychart/sprit';
public bool $disableShield = false; public bool $disableShield = false;
/** /**
@ -46,9 +41,9 @@ class App extends BaseConfig
* Index File * Index File
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* *
* Typically this will be your index.php file, unless you've renamed it to * Typically, this will be your `index.php` file, unless you've renamed it to
* something else. If you are using mod_rewrite to remove the page set this * something else. If you have configured your web server to remove this file
* variable so that it is blank. * from your site URIs, set this variable to an empty string.
*/ */
public string $indexPage = 'index.php'; public string $indexPage = 'index.php';
@ -61,9 +56,9 @@ class App extends BaseConfig
* URI string. The default setting of 'REQUEST_URI' works for most servers. * URI string. The default setting of 'REQUEST_URI' works for most servers.
* If your links do not seem to work, try one of the other delicious flavors: * If your links do not seem to work, try one of the other delicious flavors:
* *
* 'REQUEST_URI' Uses $_SERVER['REQUEST_URI'] * 'REQUEST_URI': Uses $_SERVER['REQUEST_URI']
* 'QUERY_STRING' Uses $_SERVER['QUERY_STRING'] * 'QUERY_STRING': Uses $_SERVER['QUERY_STRING']
* 'PATH_INFO' Uses $_SERVER['PATH_INFO'] * 'PATH_INFO': Uses $_SERVER['PATH_INFO']
* *
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/ */
@ -126,6 +121,8 @@ class App extends BaseConfig
* by the application in descending order of priority. If no match is * by the application in descending order of priority. If no match is
* found, the first locale will be used. * found, the first locale will be used.
* *
* IncomingRequest::setLocale() also uses this list.
*
* @var list<string> * @var list<string>
*/ */
public array $supportedLocales = ['de']; public array $supportedLocales = ['de'];
@ -137,6 +134,9 @@ class App extends BaseConfig
* *
* The default timezone that will be used in your application to display * The default timezone that will be used in your application to display
* dates with the date helper, and can be retrieved through app_timezone() * dates with the date helper, and can be retrieved through app_timezone()
*
* @see https://www.php.net/manual/en/timezones.php for list of timezones
* supported by PHP.
*/ */
public string $appTimezone = 'Europe/Vienna'; public string $appTimezone = 'Europe/Vienna';
@ -154,13 +154,13 @@ class App extends BaseConfig
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* URI PROTOCOL * Force Global Secure Requests
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* *
* If true, this will force every request made to this application to be * If true, this will force every request made to this application to be
* made via a secure connection (HTTPS). If the incoming request is not * made via a secure connection (HTTPS). If the incoming request is not
* secure, the user will be redirected to a secure version of the page * secure, the user will be redirected to a secure version of the page
* and the HTTP Strict Transport Security header will be set. * and the HTTP Strict Transport Security (HSTS) header will be set.
*/ */
public bool $forceGlobalSecureRequests = false; public bool $forceGlobalSecureRequests = false;

View File

@ -17,8 +17,6 @@ use CodeIgniter\Config\AutoloadConfig;
* *
* NOTE: This class is required prior to Autoloader instantiation, * NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig. * and does not extend BaseConfig.
*
* @immutable
*/ */
class Autoload extends AutoloadConfig class Autoload extends AutoloadConfig
{ {

View File

@ -34,18 +34,6 @@ class Cache extends BaseConfig
*/ */
public string $backupHandler = 'dummy'; public string $backupHandler = 'dummy';
/**
* --------------------------------------------------------------------------
* Cache Directory Path
* --------------------------------------------------------------------------
*
* The path to where cache files should be stored, if using a file-based
* system.
*
* @deprecated Use the driver-specific variant under $file
*/
public string $storePath = WRITEPATH . 'cache/';
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Key Prefix * Key Prefix
@ -86,6 +74,7 @@ class Cache extends BaseConfig
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* File settings * File settings
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*
* Your file storage preferences can be specified below, if you are using * Your file storage preferences can be specified below, if you are using
* the File driver. * the File driver.
* *
@ -100,6 +89,7 @@ class Cache extends BaseConfig
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* Memcached settings * Memcached settings
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*
* Your Memcached servers can be specified below, if you are using * Your Memcached servers can be specified below, if you are using
* the Memcached drivers. * the Memcached drivers.
* *
@ -118,6 +108,7 @@ class Cache extends BaseConfig
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* Redis settings * Redis settings
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*
* Your Redis server can be specified below, if you are using * Your Redis server can be specified below, if you are using
* the Redis or Predis drivers. * the Redis or Predis drivers.
* *

View File

@ -77,18 +77,3 @@ defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid u
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
*/
define('EVENT_PRIORITY_LOW', 200);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
*/
define('EVENT_PRIORITY_NORMAL', 100);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
*/
define('EVENT_PRIORITY_HIGH', 10);

View File

@ -21,58 +21,52 @@ class ContentSecurityPolicy extends BaseConfig
/** /**
* Default CSP report context * Default CSP report context
*
* @var bool
*/ */
public $reportOnly = false; public bool $reportOnly = false;
/** /**
* Specifies a URL where a browser will send reports * Specifies a URL where a browser will send reports
* when a content security policy is violated. * when a content security policy is violated.
*
* @var string|null
*/ */
public $reportURI; public ?string $reportURI = null;
/** /**
* Instructs user agents to rewrite URL schemes, changing * Instructs user agents to rewrite URL schemes, changing
* HTTP to HTTPS. This directive is for websites with * HTTP to HTTPS. This directive is for websites with
* large numbers of old URLs that need to be rewritten. * large numbers of old URLs that need to be rewritten.
*
* @var bool
*/ */
public $upgradeInsecureRequests = false; public bool $upgradeInsecureRequests = false;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Sources allowed // Sources allowed
// Note: once you set a policy to 'none', it cannot be further restricted // NOTE: once you set a policy to 'none', it cannot be further restricted
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
/** /**
* Will default to self if not overridden * Will default to self if not overridden
* *
* @var string|string[]|null * @var list<string>|string|null
*/ */
public $defaultSrc; public $defaultSrc;
/** /**
* Lists allowed scripts' URLs. * Lists allowed scripts' URLs.
* *
* @var string|string[] * @var list<string>|string
*/ */
public $scriptSrc = 'self'; public $scriptSrc = 'self';
/** /**
* Lists allowed stylesheets' URLs. * Lists allowed stylesheets' URLs.
* *
* @var string|string[] * @var list<string>|string
*/ */
public $styleSrc = 'self'; public $styleSrc = 'self';
/** /**
* Defines the origins from which images can be loaded. * Defines the origins from which images can be loaded.
* *
* @var string|string[] * @var list<string>|string
*/ */
public $imageSrc = 'self'; public $imageSrc = 'self';
@ -81,14 +75,14 @@ class ContentSecurityPolicy extends BaseConfig
* *
* Will default to self if not overridden * Will default to self if not overridden
* *
* @var string|string[]|null * @var list<string>|string|null
*/ */
public $baseURI; public $baseURI;
/** /**
* Lists the URLs for workers and embedded frame contents * Lists the URLs for workers and embedded frame contents
* *
* @var string|string[] * @var list<string>|string
*/ */
public $childSrc = 'self'; public $childSrc = 'self';
@ -96,21 +90,21 @@ class ContentSecurityPolicy extends BaseConfig
* Limits the origins that you can connect to (via XHR, * Limits the origins that you can connect to (via XHR,
* WebSockets, and EventSource). * WebSockets, and EventSource).
* *
* @var string|string[] * @var list<string>|string
*/ */
public $connectSrc = 'self'; public $connectSrc = 'self';
/** /**
* Specifies the origins that can serve web fonts. * Specifies the origins that can serve web fonts.
* *
* @var string|string[] * @var list<string>|string
*/ */
public $fontSrc; public $fontSrc;
/** /**
* Lists valid endpoints for submission from `<form>` tags. * Lists valid endpoints for submission from `<form>` tags.
* *
* @var string|string[] * @var list<string>|string
*/ */
public $formAction = 'self'; public $formAction = 'self';
@ -120,7 +114,7 @@ class ContentSecurityPolicy extends BaseConfig
* and `<applet>` tags. This directive can't be used in * and `<applet>` tags. This directive can't be used in
* `<meta>` tags and applies only to non-HTML resources. * `<meta>` tags and applies only to non-HTML resources.
* *
* @var string|string[]|null * @var list<string>|string|null
*/ */
public $frameAncestors; public $frameAncestors;
@ -128,61 +122,55 @@ class ContentSecurityPolicy extends BaseConfig
* The frame-src directive restricts the URLs which may * The frame-src directive restricts the URLs which may
* be loaded into nested browsing contexts. * be loaded into nested browsing contexts.
* *
* @var array|string|null * @var list<string>|string|null
*/ */
public $frameSrc; public $frameSrc;
/** /**
* Restricts the origins allowed to deliver video and audio. * Restricts the origins allowed to deliver video and audio.
* *
* @var string|string[]|null * @var list<string>|string|null
*/ */
public $mediaSrc; public $mediaSrc;
/** /**
* Allows control over Flash and other plugins. * Allows control over Flash and other plugins.
* *
* @var string|string[] * @var list<string>|string
*/ */
public $objectSrc = 'self'; public $objectSrc = 'self';
/** /**
* @var string|string[]|null * @var list<string>|string|null
*/ */
public $manifestSrc; public $manifestSrc;
/** /**
* Limits the kinds of plugins a page may invoke. * Limits the kinds of plugins a page may invoke.
* *
* @var string|string[]|null * @var list<string>|string|null
*/ */
public $pluginTypes; public $pluginTypes;
/** /**
* List of actions allowed. * List of actions allowed.
* *
* @var string|string[]|null * @var list<string>|string|null
*/ */
public $sandbox; public $sandbox;
/** /**
* Nonce tag for style * Nonce tag for style
*
* @var string
*/ */
public $styleNonceTag = '{csp-style-nonce}'; public string $styleNonceTag = '{csp-style-nonce}';
/** /**
* Nonce tag for script * Nonce tag for script
*
* @var string
*/ */
public $scriptNonceTag = '{csp-script-nonce}'; public string $scriptNonceTag = '{csp-script-nonce}';
/** /**
* Replace nonce tag automatically * Replace nonce tag automatically
*
* @var bool
*/ */
public $autoNonce = true; public bool $autoNonce = true;
} }

View File

@ -84,6 +84,8 @@ class Cookie extends BaseConfig
* Defaults to `Lax` for compatibility with modern browsers. Setting `''` * Defaults to `Lax` for compatibility with modern browsers. Setting `''`
* (empty string) means default SameSite attribute set by browsers (`Lax`) * (empty string) means default SameSite attribute set by browsers (`Lax`)
* will be set on cookies. If set to `None`, `$secure` must also be set. * will be set on cookies. If set to `None`, `$secure` must also be set.
*
* @phpstan-var 'None'|'Lax'|'Strict'|''
*/ */
public string $samesite = 'Lax'; public string $samesite = 'Lax';

View File

@ -10,46 +10,46 @@ use CodeIgniter\Database\Config;
class Database extends Config class Database extends Config
{ {
/** /**
* The directory that holds the Migrations * The directory that holds the Migrations and Seeds directories.
* and Seeds directories.
*
* @var string
*/ */
public $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR; public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
/** /**
* Lets you choose which connection group to * Lets you choose which connection group to use if no other is specified.
* use if no other is specified.
*
* @var string
*/ */
public $defaultGroup = 'default'; public string $defaultGroup = 'default';
/** /**
* The default database connection. * The default database connection.
* *
* @var array * @var array<string, mixed>
*/ */
public $default = [ public $default = [
// 'DSN' => 'host=192.168.16.14;dbname=mawim;user=finanzen;password=/mA!FZ22Wi',
'hostname' => '192.168.16.14', 'hostname' => '192.168.16.14',
'database' => 'mawim', 'database' => 'mawim',
'username' => 'finanzen', 'username' => 'finanzen',
'password' => '/mA!FZ22Wi', 'password' => '/mA!FZ22Wi',
'schema' => 'finanzen,verwaltung',
'port' => 5432, 'port' => 5432,
'charset' => 'utf8', 'charset' => 'utf8',
'DBDriver' => 'Postgre', 'DBDriver' => 'Postgre',
'DBDebug' => false, 'DBDebug' => false,
'schema' => 'finanzen,verwaltung',
'swapPre' => '',
'failover' => [],
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
]; ];
/** /**
* This database connection is used when * This database connection is used when running PHPUnit database tests.
* running PHPUnit database tests.
* *
* @var array * @var array<string, mixed>
*/ */
public $tests = [ public array $tests = [
'DSN' => '', 'DSN' => '',
'hostname' => '127.0.0.1', 'hostname' => '127.0.0.1',
'username' => '', 'username' => '',
@ -58,9 +58,9 @@ class Database extends Config
'DBDriver' => 'SQLite3', 'DBDriver' => 'SQLite3',
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS 'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
'pConnect' => false, 'pConnect' => false,
'DBDebug' => (ENVIRONMENT !== 'production'), 'DBDebug' => true,
'charset' => 'utf8mb4', 'charset' => 'utf8',
'DBCollat' => 'utf8mb4_general_ci', 'DBCollat' => '',
'swapPre' => '', 'swapPre' => '',
'encrypt' => false, 'encrypt' => false,
'compress' => false, 'compress' => false,
@ -68,6 +68,12 @@ class Database extends Config
'failover' => [], 'failover' => [],
'port' => 3306, 'port' => 3306,
'foreignKeys' => true, 'foreignKeys' => true,
'busyTimeout' => 1000,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
]; ];
public function __construct() public function __construct()

View File

@ -2,9 +2,6 @@
namespace Config; namespace Config;
/**
* @immutable
*/
class DocTypes class DocTypes
{ {
/** /**

View File

@ -44,10 +44,10 @@ Events::on('pre_system', static function (): void {
*/ */
if (CI_DEBUG && ! is_cli()) { if (CI_DEBUG && ! is_cli()) {
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect'); Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
Services::toolbar()->respond(); service('toolbar')->respond();
// Hot Reload route - for framework use on the hot reloader. // Hot Reload route - for framework use on the hot reloader.
if (ENVIRONMENT === 'development') { if (ENVIRONMENT === 'development') {
Services::routes()->get('__hot-reload', static function (): void { service('routes')->get('__hot-reload', static function (): void {
(new HotReloader())->run(); (new HotReloader())->run();
}); });
} }

View File

@ -10,9 +10,9 @@ use CodeIgniter\Config\BaseConfig;
class Feature extends BaseConfig class Feature extends BaseConfig
{ {
/** /**
* Use improved new auto routing instead of the default legacy version. * Use improved new auto routing instead of the legacy version.
*/ */
public bool $autoRoutesImproved = false; public bool $autoRoutesImproved = true;
/** /**
* Use filter execution order in 4.4 or before. * Use filter execution order in 4.4 or before.
@ -26,4 +26,12 @@ class Feature extends BaseConfig
* If false, `limit(0)` returns no records. (the behavior of 3.1.9 or later in version 3.x.) * If false, `limit(0)` returns no records. (the behavior of 3.1.9 or later in version 3.x.)
*/ */
public bool $limitZeroAsAll = true; public bool $limitZeroAsAll = true;
/**
* Use strict location negotiation.
*
* By default, the locale is selected based on a loose comparison of the language code (ISO 639-1)
* Enabling strict comparison will also consider the region code (ISO 3166-1 alpha-2).
*/
public bool $strictLocaleNegotiation = false;
} }

View File

@ -3,7 +3,6 @@
namespace Config; namespace Config;
use CodeIgniter\Config\BaseConfig; use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Format\FormatterInterface;
use CodeIgniter\Format\JSONFormatter; use CodeIgniter\Format\JSONFormatter;
use CodeIgniter\Format\XMLFormatter; use CodeIgniter\Format\XMLFormatter;
@ -22,9 +21,9 @@ class Format extends BaseConfig
* These formats are only checked when the data passed to the respond() * These formats are only checked when the data passed to the respond()
* method is an array. * method is an array.
* *
* @var string[] * @var list<string>
*/ */
public $supportedResponseFormats = [ public array $supportedResponseFormats = [
'application/json', 'application/json',
'application/xml', // machine-readable XML 'application/xml', // machine-readable XML
'text/xml', // human-readable XML 'text/xml', // human-readable XML
@ -41,7 +40,7 @@ class Format extends BaseConfig
* *
* @var array<string, string> * @var array<string, string>
*/ */
public $formatters = [ public array $formatters = [
'application/json' => JSONFormatter::class, 'application/json' => JSONFormatter::class,
'application/xml' => XMLFormatter::class, 'application/xml' => XMLFormatter::class,
'text/xml' => XMLFormatter::class, 'text/xml' => XMLFormatter::class,
@ -57,21 +56,9 @@ class Format extends BaseConfig
* *
* @var array<string, int> * @var array<string, int>
*/ */
public $formatterOptions = [ public array $formatterOptions = [
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES, 'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
'application/xml' => 0, 'application/xml' => 0,
'text/xml' => 0, 'text/xml' => 0,
]; ];
/**
* A Factory method to return the appropriate formatter for the given mime type.
*
* @return FormatterInterface
*
* @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead.
*/
public function getFormatter(string $mime)
{
return Services::format()->getFormatter($mime);
}
} }

View File

@ -10,25 +10,21 @@ class Images extends BaseConfig
{ {
/** /**
* Default handler used if no other handler is specified. * Default handler used if no other handler is specified.
*
* @var string
*/ */
public $defaultHandler = 'gd'; public string $defaultHandler = 'gd';
/** /**
* The path to the image library. * The path to the image library.
* Required for ImageMagick, GraphicsMagick, or NetPBM. * Required for ImageMagick, GraphicsMagick, or NetPBM.
*
* @var string
*/ */
public $libraryPath = '/usr/local/bin/convert'; public string $libraryPath = '/usr/local/bin/convert';
/** /**
* The available handler classes. * The available handler classes.
* *
* @var array<string, string> * @var array<string, string>
*/ */
public $handlers = [ public array $handlers = [
'gd' => GDHandler::class, 'gd' => GDHandler::class,
'imagick' => ImageMagickHandler::class, 'imagick' => ImageMagickHandler::class,
]; ];

View File

@ -3,7 +3,6 @@
namespace Config; namespace Config;
use Kint\Parser\ConstructablePluginInterface; use Kint\Parser\ConstructablePluginInterface;
use Kint\Renderer\AbstractRenderer;
use Kint\Renderer\Rich\TabPluginInterface; use Kint\Renderer\Rich\TabPluginInterface;
use Kint\Renderer\Rich\ValuePluginInterface; use Kint\Renderer\Rich\ValuePluginInterface;
@ -41,7 +40,6 @@ class Kint
*/ */
public string $richTheme = 'aante-light.css'; public string $richTheme = 'aante-light.css';
public bool $richFolder = false; public bool $richFolder = false;
public int $richSort = AbstractRenderer::SORT_FULL;
/** /**
* @var array<string, class-string<ValuePluginInterface>>|null * @var array<string, class-string<ValuePluginInterface>>|null

View File

@ -82,7 +82,6 @@ class Logger extends BaseConfig
* -------------------------------------------------------------------- * --------------------------------------------------------------------
*/ */
FileHandler::class => [ FileHandler::class => [
// The log levels that this handler will handle. // The log levels that this handler will handle.
'handles' => [ 'handles' => [
'critical', 'critical',

View File

@ -3,8 +3,6 @@
namespace Config; namespace Config;
/** /**
* Mimes
*
* This file contains an array of mime types. It is used by the * This file contains an array of mime types. It is used by the
* Upload class to help identify allowed file types. * Upload class to help identify allowed file types.
* *
@ -15,8 +13,6 @@ namespace Config;
* *
* When working with mime types, please make sure you have the ´fileinfo´ * When working with mime types, please make sure you have the ´fileinfo´
* extension enabled to reliably detect the media types. * extension enabled to reliably detect the media types.
*
* @immutable
*/ */
class Mimes class Mimes
{ {
@ -482,6 +478,8 @@ class Mimes
'application/sla', 'application/sla',
'application/vnd.ms-pki.stl', 'application/vnd.ms-pki.stl',
'application/x-navistyle', 'application/x-navistyle',
'model/stl',
'application/octet-stream',
], ],
]; ];

View File

@ -9,8 +9,6 @@ use CodeIgniter\Modules\Modules as BaseModules;
* *
* NOTE: This class is required prior to Autoloader instantiation, * NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig. * and does not extend BaseConfig.
*
* @immutable
*/ */
class Modules extends BaseModules class Modules extends BaseModules
{ {

View File

@ -7,8 +7,6 @@ namespace Config;
* *
* NOTE: This class does not extend BaseConfig for performance reasons. * NOTE: This class does not extend BaseConfig for performance reasons.
* So you cannot replace the property values with Environment Variables. * So you cannot replace the property values with Environment Variables.
*
* @immutable
*/ */
class Optimize class Optimize
{ {

View File

@ -20,7 +20,7 @@ class Pager extends BaseConfig
* *
* @var array<string, string> * @var array<string, string>
*/ */
public $templates = [ public array $templates = [
'default_full' => 'CodeIgniter\Pager\Views\default_full', 'default_full' => 'CodeIgniter\Pager\Views\default_full',
'default_simple' => 'CodeIgniter\Pager\Views\default_simple', 'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
'default_head' => 'CodeIgniter\Pager\Views\default_head', 'default_head' => 'CodeIgniter\Pager\Views\default_head',
@ -32,8 +32,6 @@ class Pager extends BaseConfig
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* *
* The default number of results shown in a single page. * The default number of results shown in a single page.
*
* @var int
*/ */
public $perPage = 20; public int $perPage = 20;
} }

View File

@ -12,6 +12,9 @@ namespace Config;
* share a system folder between multiple applications, and more. * share a system folder between multiple applications, and more.
* *
* All paths are relative to the project's root folder. * All paths are relative to the project's root folder.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*/ */
class Paths class Paths
{ {
@ -22,8 +25,6 @@ class Paths
* *
* This must contain the name of your "system" folder. Include * This must contain the name of your "system" folder. Include
* the path if the folder is not in the same directory as this file. * the path if the folder is not in the same directory as this file.
*
* @var string
*/ */
public $systemDirectory = __DIR__ . '/../../../vendor/codeigniter4/framework/system'; public $systemDirectory = __DIR__ . '/../../../vendor/codeigniter4/framework/system';
@ -38,10 +39,8 @@ class Paths
* you do, use a full server path. * you do, use a full server path.
* *
* @see http://codeigniter.com/user_guide/general/managing_apps.html * @see http://codeigniter.com/user_guide/general/managing_apps.html
*
* @var string
*/ */
public $appDirectory = __DIR__ . '/..'; public string $appDirectory = __DIR__ . '/..';
/** /**
* --------------------------------------------------------------- * ---------------------------------------------------------------
@ -53,10 +52,8 @@ class Paths
* need write permission to a single place that can be tucked away * need write permission to a single place that can be tucked away
* for maximum security, keeping it out of the app and/or * for maximum security, keeping it out of the app and/or
* system directories. * system directories.
*
* @var string
*/ */
public $writableDirectory = __DIR__ . '/../../writable'; public string $writableDirectory = __DIR__ . '/../../writable';
/** /**
* --------------------------------------------------------------- * ---------------------------------------------------------------
@ -64,10 +61,8 @@ class Paths
* --------------------------------------------------------------- * ---------------------------------------------------------------
* *
* This variable must contain the name of your "tests" directory. * This variable must contain the name of your "tests" directory.
*
* @var string
*/ */
public $testsDirectory = __DIR__ . '/../../tests'; public string $testsDirectory = __DIR__ . '/../../tests';
/** /**
* --------------------------------------------------------------- * ---------------------------------------------------------------
@ -78,8 +73,6 @@ class Paths
* contains the view files used by your application. By * contains the view files used by your application. By
* default this is in `app/Views`. This value * default this is in `app/Views`. This value
* is used when no value is provided to `Services::renderer()`. * is used when no value is provided to `Services::renderer()`.
*
* @var string
*/ */
public $viewDirectory = __DIR__ . '/../Views'; public string $viewDirectory = __DIR__ . '/../Views';
} }

View File

@ -136,5 +136,5 @@ class Routing extends BaseRouting
* *
* Default: false * Default: false
*/ */
public bool $translateUriToCamelCase = false; public bool $translateUriToCamelCase = true;
} }

View File

@ -83,21 +83,4 @@ class Security extends BaseConfig
* @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure * @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure
*/ */
public bool $redirect = (ENVIRONMENT === 'production'); public bool $redirect = (ENVIRONMENT === 'production');
/**
* --------------------------------------------------------------------------
* CSRF SameSite
* --------------------------------------------------------------------------
*
* Setting for CSRF SameSite cookie token.
*
* Allowed values are: None - Lax - Strict - ''.
*
* Defaults to `Lax` as recommended in this link:
*
* @see https://portswigger.net/web-security/csrf/samesite-cookies
*
* @deprecated `Config\Cookie` $samesite property is used.
*/
public string $samesite = 'Lax';
} }

View File

@ -23,7 +23,7 @@ class UserAgents extends BaseConfig
* *
* @var array<string, string> * @var array<string, string>
*/ */
public $platforms = [ public array $platforms = [
'windows nt 10.0' => 'Windows 10', 'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1', 'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8', 'windows nt 6.2' => 'Windows 8',
@ -78,7 +78,7 @@ class UserAgents extends BaseConfig
* *
* @var array<string, string> * @var array<string, string>
*/ */
public $browsers = [ public array $browsers = [
'OPR' => 'Opera', 'OPR' => 'Opera',
'Flock' => 'Flock', 'Flock' => 'Flock',
'Edge' => 'Spartan', 'Edge' => 'Spartan',
@ -119,7 +119,7 @@ class UserAgents extends BaseConfig
* *
* @var array<string, string> * @var array<string, string>
*/ */
public $mobiles = [ public array $mobiles = [
// legacy array, old values commented out // legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer', 'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave', // 'openwave' => 'Open Wave',
@ -228,7 +228,7 @@ class UserAgents extends BaseConfig
* *
* @var array<string, string> * @var array<string, string>
*/ */
public $robots = [ public array $robots = [
'googlebot' => 'Googlebot', 'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot', 'msnbot' => 'MSNBot',
'baiduspider' => 'Baiduspider', 'baiduspider' => 'Baiduspider',

View File

@ -3,10 +3,10 @@
namespace Config; namespace Config;
use CodeIgniter\Config\BaseConfig; use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Validation\CreditCardRules; use CodeIgniter\Validation\StrictRules\CreditCardRules;
use CodeIgniter\Validation\FileRules; use CodeIgniter\Validation\StrictRules\FileRules;
use CodeIgniter\Validation\FormatRules; use CodeIgniter\Validation\StrictRules\FormatRules;
use CodeIgniter\Validation\Rules; use CodeIgniter\Validation\StrictRules\Rules;
class Validation extends BaseConfig class Validation extends BaseConfig
{ {

View File

@ -33,12 +33,18 @@ abstract class BaseController extends Controller
* class instantiation. These helpers will be available * class instantiation. These helpers will be available
* to all other controllers that extend BaseController. * to all other controllers that extend BaseController.
* *
* @var array * @var list<string>
*/ */
protected $helpers = []; protected $helpers = [];
/** /**
* Constructor. * Be sure to declare properties for any property fetch you initialized.
* The creation of dynamic property is deprecated in PHP 8.2.
*/
// protected $session;
/**
* @return void
*/ */
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{ {
@ -47,6 +53,6 @@ abstract class BaseController extends Controller
// Preload any models, libraries, etc, here. // Preload any models, libraries, etc, here.
// E.g.: $this->session = \Config\Services::session(); // E.g.: $this->session = service('session');
} }
} }

View File

@ -50,9 +50,9 @@ if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) {
$function .= $padClass . $error['function']; $function .= $padClass . $error['function'];
} }
$args = implode(', ', array_map(static fn ($value) => match (true) { $args = implode(', ', array_map(static fn ($value): string => match (true) {
is_object($value) => 'Object(' . $value::class . ')', is_object($value) => 'Object(' . $value::class . ')',
is_array($value) => count($value) ? '[...]' : '[]', is_array($value) => $value !== [] ? '[...]' : '[]',
$value === null => 'null', // return the lowercased version $value === null => 'null', // return the lowercased version
default => var_export($value, true), default => var_export($value, true),
}, array_values($error['args'] ?? []))); }, array_values($error['args'] ?? [])));

View File

@ -3,7 +3,7 @@
--main-text-color: #555; --main-text-color: #555;
--dark-text-color: #222; --dark-text-color: #222;
--light-text-color: #c7c7c7; --light-text-color: #c7c7c7;
--brand-primary-color: #E06E3F; --brand-primary-color: #DC4814;
--light-bg-color: #ededee; --light-bg-color: #ededee;
--dark-bg-color: #404040; --dark-bg-color: #404040;
} }
@ -41,6 +41,7 @@ p.lead {
.header { .header {
background: var(--light-bg-color); background: var(--light-bg-color);
color: var(--dark-text-color); color: var(--dark-text-color);
margin-top: 2.17rem;
} }
.header .container { .header .container {
padding: 1rem; padding: 1rem;
@ -65,10 +66,13 @@ p.lead {
} }
.environment { .environment {
background: var(--dark-bg-color); background: var(--brand-primary-color);
color: var(--light-text-color); color: var(--main-bg-color);
text-align: center; text-align: center;
padding: 0.2rem; padding: calc(4px + 0.2083vw);
width: 100%;
top: 0;
position: fixed;
} }
.source { .source {

View File

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?= lang('Errors.badRequest') ?></title>
<style>
div.logo {
height: 200px;
width: 155px;
display: inline-block;
opacity: 0.08;
position: absolute;
top: 2rem;
left: 50%;
margin-left: -73px;
}
body {
height: 100%;
background: #fafafa;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #777;
font-weight: 300;
}
h1 {
font-weight: lighter;
letter-spacing: normal;
font-size: 3rem;
margin-top: 0;
margin-bottom: 0;
color: #222;
}
.wrap {
max-width: 1024px;
margin: 5rem auto;
padding: 2rem;
background: #fff;
text-align: center;
border: 1px solid #efefef;
border-radius: 0.5rem;
position: relative;
}
pre {
white-space: normal;
margin-top: 1.5rem;
}
code {
background: #fafafa;
border: 1px solid #efefef;
padding: 0.5rem 1rem;
border-radius: 5px;
display: block;
}
p {
margin-top: 1.5rem;
}
.footer {
margin-top: 2rem;
border-top: 1px solid #efefef;
padding: 1em 2em 0 2em;
font-size: 85%;
color: #999;
}
a:active,
a:link,
a:visited {
color: #dd4814;
}
</style>
</head>
<body>
<div class="wrap">
<h1>400</h1>
<p>
<?php if (ENVIRONMENT !== 'production') : ?>
<?= nl2br(esc($message)) ?>
<?php else : ?>
<?= lang('Errors.sorryBadRequest') ?>
<?php endif; ?>
</p>
</div>
</body>
</html>

View File

@ -1,6 +1,5 @@
<?php <?php
use CodeIgniter\HTTP\Header; use CodeIgniter\HTTP\Header;
use Config\Services;
use CodeIgniter\CodeIgniter; use CodeIgniter\CodeIgniter;
$errorId = uniqid('error', true); $errorId = uniqid('error', true);
@ -225,7 +224,7 @@ $errorId = uniqid('error', true);
<!-- Request --> <!-- Request -->
<div class="content" id="request"> <div class="content" id="request">
<?php $request = Services::request(); ?> <?php $request = service('request'); ?>
<table> <table>
<tbody> <tbody>
@ -343,7 +342,7 @@ $errorId = uniqid('error', true);
<!-- Response --> <!-- Response -->
<?php <?php
$response = Services::response(); $response = service('response');
$response->setStatusCode(http_response_code()); $response->setStatusCode(http_response_code());
?> ?>
<div class="content" id="response"> <div class="content" id="response">

View File

@ -4,9 +4,9 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="robots" content="noindex"> <meta name="robots" content="noindex">
<title>Whoops!</title> <title><?= lang('Errors.whoops') ?></title>
<style type="text/css"> <style>
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?> <?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
</style> </style>
</head> </head>
@ -14,9 +14,9 @@
<div class="container text-center"> <div class="container text-center">
<h1 class="headline">Whoops!</h1> <h1 class="headline"><?= lang('Errors.whoops') ?></h1>
<p class="lead">We seem to have hit a snag. Please try again later...</p> <p class="lead"><?= lang('Errors.weHitASnag') ?></p>
</div> </div>

View File

@ -1,5 +1,8 @@
<?php <?php
use CodeIgniter\Boot;
use Config\Paths;
/* /*
*--------------------------------------------------------------- *---------------------------------------------------------------
* CHECK PHP VERSION * CHECK PHP VERSION
@ -11,7 +14,7 @@ if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
$message = sprintf( $message = sprintf(
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s', 'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
$minPhpVersion, $minPhpVersion,
PHP_VERSION PHP_VERSION,
); );
header('HTTP/1.1 503 Service Unavailable.', true, 503); header('HTTP/1.1 503 Service Unavailable.', true, 503);
@ -48,9 +51,9 @@ if (getcwd() . DIRECTORY_SEPARATOR !== FCPATH) {
require FCPATH . '../app/Config/Paths.php'; require FCPATH . '../app/Config/Paths.php';
// ^^^ Change this line if you move your application folder // ^^^ Change this line if you move your application folder
$paths = new Config\Paths(); $paths = new Paths();
// LOAD THE FRAMEWORK BOOTSTRAP FILE // LOAD THE FRAMEWORK BOOTSTRAP FILE
require $paths->systemDirectory . '/Boot.php'; require $paths->systemDirectory . '/Boot.php';
exit(CodeIgniter\Boot::bootWeb($paths)); exit(Boot::bootWeb($paths));

11
writable/index.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>