From 981277ae14814c80838a3a26ce4af424e8bbf5f2 Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Thu, 6 Jul 2023 15:56:05 +0000 Subject: [PATCH] build(ci4): update CodeIgniter to v4.3.6 --- app/Common.php | 2 +- app/Config/App.php | 52 +++++++++-- app/Config/Autoload.php | 21 ++++- app/Config/Database.php | 5 +- app/Config/DocTypes.php | 10 ++ app/Config/Email.php | 2 +- app/Config/Encryption.php | 33 +++++++ app/Config/Exceptions.php | 25 +++++ app/Config/Generators.php | 2 + app/Config/Honeypot.php | 9 ++ app/Config/Kint.php | 4 +- app/Config/Logger.php | 2 +- app/Config/Mimes.php | 11 ++- app/Config/Modules.php | 23 +++++ app/Config/Pager.php | 2 +- app/Config/Routes.php | 6 -- app/Config/Security.php | 2 +- app/Config/Session.php | 104 +++++++++++++++++++++ app/Config/Validation.php | 8 +- app/Controllers/BaseController.php | 8 ++ app/Controllers/ColorsController.php | 7 ++ app/Views/errors/html/error_404.php | 6 +- app/Views/errors/html/error_exception.php | 40 ++++---- app/Views/errors/html/production.php | 6 +- composer.json | 11 ++- composer.lock | 107 +++++----------------- env | 23 +++-- phpstan.neon | 1 + public/.htaccess | 2 +- public/index.php | 4 +- spark | 9 +- 31 files changed, 387 insertions(+), 160 deletions(-) create mode 100644 app/Config/Session.php diff --git a/app/Common.php b/app/Common.php index 6876d968..d3cc2142 100644 --- a/app/Common.php +++ b/app/Common.php @@ -14,7 +14,7 @@ use ViewThemes\Theme; * This can be looked at as a `master helper` file that is loaded early on, and may also contain additional functions * that you'd like to use throughout your entire application * - * @link: https://codeigniter4.github.io/CodeIgniter4/ + * @see: https://codeigniter.com/user_guide/extending/common.html */ if (! function_exists('view')) { diff --git a/app/Config/App.php b/app/Config/App.php index a80b7ad3..ab7efc97 100644 --- a/app/Config/App.php +++ b/app/Config/App.php @@ -14,18 +14,27 @@ class App extends BaseConfig * 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: * * 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 = 'http://localhost:8080/'; + /** + * Allowed Hostnames in the Site URL other than the hostname in the baseURL. + * If you want to accept multiple Hostnames, set this. + * + * E.g. When your site URL ($baseURL) is 'http://example.com/', and your site + * also accepts 'http://media.example.com/' and + * 'http://accounts.example.com/': + * ['media.example.com', 'accounts.example.com'] + * + * @var string[] + * @phpstan-var list + */ + public array $allowedHostnames = []; + /** * -------------------------------------------------------------------------- * Index File @@ -87,6 +96,8 @@ class App extends BaseConfig * by the application in descending order of priority. If no match is * found, the first locale will be used. * + * IncomingRequest::setLocale() also uses this list. + * * @var string[] */ public array $supportedLocales = ['en', 'fr', 'pl', 'de', 'pt-BR', 'nn-NO', 'es', 'zh-Hans', 'ca']; @@ -98,6 +109,8 @@ class App extends BaseConfig * * The default timezone that will be used in your application to display * 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 = 'UTC'; @@ -135,6 +148,8 @@ class App extends BaseConfig * - `CodeIgniter\Session\Handlers\DatabaseHandler` * - `CodeIgniter\Session\Handlers\MemcachedHandler` * - `CodeIgniter\Session\Handlers\RedisHandler` + * + * @deprecated use Config\Session::$driver instead. */ public string $sessionDriver = FileHandler::class; @@ -144,6 +159,8 @@ class App extends BaseConfig * -------------------------------------------------------------------------- * * The session cookie name, must contain only [0-9a-z_-] characters + * + * @deprecated use Config\Session::$cookieName instead. */ public string $sessionCookieName = 'ci_session'; @@ -154,6 +171,8 @@ class App extends BaseConfig * * The number of SECONDS you want the session to last. * Setting to 0 (zero) means expire when the browser is closed. + * + * @deprecated use Config\Session::$expiration instead. */ public int $sessionExpiration = 7200; @@ -171,6 +190,8 @@ class App extends BaseConfig * Please read up the manual for the format with other session drivers. * * IMPORTANT: You are REQUIRED to set a valid save path! + * + * @deprecated use Config\Session::$savePath instead. */ public string $sessionSavePath = WRITEPATH . 'session'; @@ -183,6 +204,8 @@ class App extends BaseConfig * * WARNING: If you're using the database driver, don't forget to update * your session table's PRIMARY KEY when changing this setting. + * + * @deprecated use Config\Session::$matchIP instead. */ public bool $sessionMatchIP = false; @@ -192,6 +215,8 @@ class App extends BaseConfig * -------------------------------------------------------------------------- * * How many seconds between CI regenerating the session ID. + * + * @deprecated use Config\Session::$timeToUpdate instead. */ public int $sessionTimeToUpdate = 300; @@ -203,9 +228,22 @@ class App extends BaseConfig * Whether to destroy session data associated with the old session ID * when auto-regenerating the session ID. When set to FALSE, the data * will be later deleted by the garbage collector. + * + * @deprecated use Config\Session::$regenerateDestroy instead. */ public bool $sessionRegenerateDestroy = false; + /** + * -------------------------------------------------------------------------- + * Session Database Group + * -------------------------------------------------------------------------- + * + * DB Group for the database session. + * + * @deprecated use Config\Session::$DBGroup instead. + */ + public ?string $sessionDBGroup = null; + /** * -------------------------------------------------------------------------- * Cookie Prefix @@ -283,7 +321,7 @@ class App extends BaseConfig * * @deprecated `Config\Cookie` $samesite property is used. */ - public string $cookieSameSite = 'Lax'; + public ?string $cookieSameSite = 'Lax'; /** * -------------------------------------------------------------------------- diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php index 26d55e20..e1192856 100644 --- a/app/Config/Autoload.php +++ b/app/Config/Autoload.php @@ -93,12 +93,27 @@ class Autoload extends AutoloadConfig * or for loading functions. * * Prototype: - * ``` + * * $files = [ * '/path/to/my/file.php', * ]; - * ``` - * @var array + * + * @var string[] + * @phpstan-var list */ public $files = [APPPATH . 'Libraries/ViewComponents/Helpers/view_components_helper.php']; + + /** + * ------------------------------------------------------------------- + * Helpers + * ------------------------------------------------------------------- + * Prototype: + * $helpers = [ + * 'form', + * ]; + * + * @var string[] + * @phpstan-var list + */ + public $helpers = []; } diff --git a/app/Config/Database.php b/app/Config/Database.php index ac346971..aca95f04 100644 --- a/app/Config/Database.php +++ b/app/Config/Database.php @@ -35,7 +35,7 @@ class Database extends Config 'DBDriver' => 'MySQLi', 'DBPrefix' => 'cp_', 'pConnect' => false, - 'DBDebug' => ENVIRONMENT !== 'production', + 'DBDebug' => true, 'charset' => 'utf8mb4', 'DBCollat' => 'utf8mb4_unicode_ci', 'swapPre' => '', @@ -61,7 +61,7 @@ class Database extends Config 'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS 'pConnect' => false, - 'DBDebug' => (ENVIRONMENT !== 'production'), + 'DBDebug' => true, 'charset' => 'utf8', 'DBCollat' => 'utf8_general_ci', 'swapPre' => '', @@ -71,6 +71,7 @@ class Database extends Config 'failover' => [], 'port' => 3306, 'foreignKeys' => true, + 'busyTimeout' => 1000, ]; //-------------------------------------------------------------------- diff --git a/app/Config/DocTypes.php b/app/Config/DocTypes.php index fa084af2..62ad9e07 100644 --- a/app/Config/DocTypes.php +++ b/app/Config/DocTypes.php @@ -32,4 +32,14 @@ class DocTypes 'xhtml-rdfa-1' => '', 'xhtml-rdfa-2' => '', ]; + + /** + * Whether to remove the solidus (`/`) character for void HTML elements (e.g. ``) + * for HTML5 compatibility. + * + * Set to: + * `true` - to be HTML5 compatible + * `false` - to be XHTML compatible + */ + public bool $html5 = true; } diff --git a/app/Config/Email.php b/app/Config/Email.php index c8713ee8..990eb2ef 100644 --- a/app/Config/Email.php +++ b/app/Config/Email.php @@ -12,7 +12,7 @@ class Email extends BaseConfig public string $fromName = 'Castopod'; - public string $recipients; + public string $recipients = ''; /** * The "user agent" diff --git a/app/Config/Encryption.php b/app/Config/Encryption.php index a69b8b38..58409b18 100644 --- a/app/Config/Encryption.php +++ b/app/Config/Encryption.php @@ -58,4 +58,37 @@ class Encryption extends BaseConfig * HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'. */ public string $digest = 'SHA512'; + + /** + * Whether the cipher-text should be raw. If set to false, then it will be base64 encoded. + * This setting is only used by OpenSSLHandler. + * + * Set to false for CI3 Encryption compatibility. + */ + public bool $rawData = true; + + /** + * Encryption key info. + * This setting is only used by OpenSSLHandler. + * + * Set to 'encryption' for CI3 Encryption compatibility. + */ + public string $encryptKeyInfo = ''; + + /** + * Authentication key info. + * This setting is only used by OpenSSLHandler. + * + * Set to 'authentication' for CI3 Encryption compatibility. + */ + public string $authKeyInfo = ''; + + /** + * Cipher to use. + * This setting is only used by OpenSSLHandler. + * + * Set to 'AES-128-CBC' to decrypt encrypted data that encrypted + * by CI3 Encryption default configuration. + */ + public string $cipher = 'AES-256-CTR'; } diff --git a/app/Config/Exceptions.php b/app/Config/Exceptions.php index 84f48647..0c7c681f 100644 --- a/app/Config/Exceptions.php +++ b/app/Config/Exceptions.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Config; use CodeIgniter\Config\BaseConfig; +use Psr\Log\LogLevel; /** * Setup how the exception handler works. @@ -55,4 +56,28 @@ class Exceptions extends BaseConfig * @var string[] */ public array $sensitiveDataInTrace = []; + + /** + * -------------------------------------------------------------------------- + * LOG DEPRECATIONS INSTEAD OF THROWING? + * -------------------------------------------------------------------------- + * By default, CodeIgniter converts deprecations into exceptions. Also, + * starting in PHP 8.1 will cause a lot of deprecated usage warnings. + * Use this option to temporarily cease the warnings and instead log those. + * This option also works for user deprecations. + */ + public bool $logDeprecations = true; + + /** + * -------------------------------------------------------------------------- + * LOG LEVEL THRESHOLD FOR DEPRECATIONS + * -------------------------------------------------------------------------- + * If `$logDeprecations` is set to `true`, this sets the log level + * to which the deprecation will be logged. This should be one of the log + * levels recognized by PSR-3. + * + * The related `Config\Logger::$threshold` should be adjusted, if needed, + * to capture logging the deprecations. + */ + public string $deprecationLogLevel = LogLevel::WARNING; } diff --git a/app/Config/Generators.php b/app/Config/Generators.php index 5c4d7d08..ccc7c41d 100644 --- a/app/Config/Generators.php +++ b/app/Config/Generators.php @@ -28,6 +28,8 @@ class Generators extends BaseConfig * @var array */ public array $views = [ + 'make:cell' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php', + 'make:cell_view' => 'CodeIgniter\Commands\Generators\Views\cell_view.tpl.php', 'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php', 'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php', 'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php', diff --git a/app/Config/Honeypot.php b/app/Config/Honeypot.php index e47cfdf4..67df089b 100644 --- a/app/Config/Honeypot.php +++ b/app/Config/Honeypot.php @@ -30,6 +30,15 @@ class Honeypot extends BaseConfig /** * Honeypot container + * + * If you enabled CSP, you can remove `style="display:none"`. */ public string $container = '
{template}
'; + + /** + * The id attribute for Honeypot container tag + * + * Used when CSP is enabled. + */ + public string $containerId = 'hpc'; } diff --git a/app/Config/Kint.php b/app/Config/Kint.php index c814e564..d68979ab 100644 --- a/app/Config/Kint.php +++ b/app/Config/Kint.php @@ -5,7 +5,7 @@ declare(strict_types=1); namespace Config; use CodeIgniter\Config\BaseConfig; -use Kint\Renderer\Renderer; +use Kint\Renderer\AbstractRenderer; /** * -------------------------------------------------------------------------- @@ -46,7 +46,7 @@ class Kint extends BaseConfig public bool $richFolder = false; - public int $richSort = Renderer::SORT_FULL; + public int $richSort = AbstractRenderer::SORT_FULL; /** * @var string[] diff --git a/app/Config/Logger.php b/app/Config/Logger.php index ad866070..d135fa1b 100644 --- a/app/Config/Logger.php +++ b/app/Config/Logger.php @@ -40,7 +40,7 @@ class Logger extends BaseConfig * * @var int|int[] */ - public int | array $threshold = 4; + public int | array $threshold = (ENVIRONMENT === 'production') ? 4 : 9; /** * -------------------------------------------------------------------------- diff --git a/app/Config/Mimes.php b/app/Config/Mimes.php index 433c932f..8e7324f6 100644 --- a/app/Config/Mimes.php +++ b/app/Config/Mimes.php @@ -50,10 +50,13 @@ class Mimes 'application/x-binary', 'application/x-macbinary', ], - 'dms' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'exe' => ['application/octet-stream', 'application/x-msdownload'], + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => ['application/octet-stream', + 'application/vnd.microsoft.portable-executable', + 'application/x-dosexec', + 'application/x-msdownload'], 'class' => 'application/octet-stream', 'psd' => ['application/x-photoshop', 'image/vnd.adobe.photoshop'], 'so' => 'application/octet-stream', diff --git a/app/Config/Modules.php b/app/Config/Modules.php index e17d03f7..fb4c234a 100644 --- a/app/Config/Modules.php +++ b/app/Config/Modules.php @@ -33,6 +33,29 @@ class Modules extends BaseModules */ public $discoverInComposer = true; + /** + * The Composer package list for Auto-Discovery + * This setting is optional. + * + * E.g.: + * [ + * 'only' => [ + * // List up all packages to auto-discover + * 'codeigniter4/shield', + * ], + * ] + * or + * [ + * 'exclude' => [ + * // List up packages to exclude. + * 'pestphp/pest', + * ], + * ] + * + * @var array{only?:string[], exclude?:string[]} + */ + public $composerPackages = []; + /** * -------------------------------------------------------------------------- * Auto-Discovery Rules diff --git a/app/Config/Pager.php b/app/Config/Pager.php index 33acacea..b9e8b6d1 100644 --- a/app/Config/Pager.php +++ b/app/Config/Pager.php @@ -22,7 +22,7 @@ class Pager extends BaseConfig * * @var array */ - public $templates = [ + public array $templates = [ 'default_full' => 'App\Views\pager\default_full', 'default_simple' => 'CodeIgniter\Pager\Views\default_simple', 'default_head' => 'CodeIgniter\Pager\Views\default_head', diff --git a/app/Config/Routes.php b/app/Config/Routes.php index ae3c9365..5eaff586 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -7,12 +7,6 @@ namespace Config; // Create a new instance of our RouteCollection class. $routes = Services::routes(); -// Load the system's routing file first, so that the app and ENVIRONMENT -// can override as needed. -if (is_file(SYSTEMPATH . 'Config/Routes.php')) { - require SYSTEMPATH . 'Config/Routes.php'; -} - /** * -------------------------------------------------------------------- * Router Setup diff --git a/app/Config/Security.php b/app/Config/Security.php index 29b51d2f..7f0c44de 100644 --- a/app/Config/Security.php +++ b/app/Config/Security.php @@ -82,7 +82,7 @@ class Security extends BaseConfig * * Redirect to previous page with error on failure. */ - public bool $redirect = true; + public bool $redirect = false; /** * -------------------------------------------------------------------------- diff --git a/app/Config/Session.php b/app/Config/Session.php new file mode 100644 index 00000000..73ad8e56 --- /dev/null +++ b/app/Config/Session.php @@ -0,0 +1,104 @@ + + */ + public string $driver = FileHandler::class; + + /** + * -------------------------------------------------------------------------- + * Session Cookie Name + * -------------------------------------------------------------------------- + * + * The session cookie name, must contain only [0-9a-z_-] characters + */ + public string $cookieName = 'ci_session'; + + /** + * -------------------------------------------------------------------------- + * Session Expiration + * -------------------------------------------------------------------------- + * + * The number of SECONDS you want the session to last. + * Setting to 0 (zero) means expire when the browser is closed. + */ + public int $expiration = 7200; + + /** + * -------------------------------------------------------------------------- + * Session Save Path + * -------------------------------------------------------------------------- + * + * The location to save sessions to and is driver dependent. + * + * For the 'files' driver, it's a path to a writable directory. + * WARNING: Only absolute paths are supported! + * + * For the 'database' driver, it's a table name. + * Please read up the manual for the format with other session drivers. + * + * IMPORTANT: You are REQUIRED to set a valid save path! + */ + public string $savePath = WRITEPATH . 'session'; + + /** + * -------------------------------------------------------------------------- + * Session Match IP + * -------------------------------------------------------------------------- + * + * Whether to match the user's IP address when reading the session data. + * + * WARNING: If you're using the database driver, don't forget to update + * your session table's PRIMARY KEY when changing this setting. + */ + public bool $matchIP = false; + + /** + * -------------------------------------------------------------------------- + * Session Time to Update + * -------------------------------------------------------------------------- + * + * How many seconds between CI regenerating the session ID. + */ + public int $timeToUpdate = 300; + + /** + * -------------------------------------------------------------------------- + * Session Regenerate Destroy + * -------------------------------------------------------------------------- + * + * Whether to destroy session data associated with the old session ID + * when auto-regenerating the session ID. When set to FALSE, the data + * will be later deleted by the garbage collector. + */ + public bool $regenerateDestroy = false; + + /** + * -------------------------------------------------------------------------- + * Session Database Group + * -------------------------------------------------------------------------- + * + * DB Group for the database session. + */ + public ?string $DBGroup = null; +} diff --git a/app/Config/Validation.php b/app/Config/Validation.php index ab49e451..1cdb16d4 100644 --- a/app/Config/Validation.php +++ b/app/Config/Validation.php @@ -6,10 +6,10 @@ namespace Config; use App\Validation\FileRules as AppFileRules; use CodeIgniter\Config\BaseConfig; -use CodeIgniter\Validation\CreditCardRules; -use CodeIgniter\Validation\FileRules; -use CodeIgniter\Validation\FormatRules; -use CodeIgniter\Validation\Rules; +use CodeIgniter\Validation\StrictRules\CreditCardRules; +use CodeIgniter\Validation\StrictRules\FileRules; +use CodeIgniter\Validation\StrictRules\FormatRules; +use CodeIgniter\Validation\StrictRules\Rules; class Validation extends BaseConfig { diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 9edba659..7bfc7c21 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -7,6 +7,7 @@ namespace App\Controllers; use CodeIgniter\Controller; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\RequestInterface; +use CodeIgniter\HTTP\Response; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; use ViewThemes\Theme; @@ -28,6 +29,13 @@ abstract class BaseController extends Controller */ protected $request; + /** + * Instance of the main response object. + * + * @var Response + */ + protected $response; + /** * An array of helpers to be loaded automatically upon * class instantiation. These helpers will be available diff --git a/app/Controllers/ColorsController.php b/app/Controllers/ColorsController.php index 87875a49..82d6eed9 100644 --- a/app/Controllers/ColorsController.php +++ b/app/Controllers/ColorsController.php @@ -15,6 +15,13 @@ use CodeIgniter\HTTP\Response; class ColorsController extends Controller { + /** + * Instance of the main response object. + * + * @var Response + */ + protected $response; + public function index(): Response { $cacheName = 'colors.css'; diff --git a/app/Views/errors/html/error_404.php b/app/Views/errors/html/error_404.php index bbf30689..092217de 100644 --- a/app/Views/errors/html/error_404.php +++ b/app/Views/errors/html/error_404.php @@ -6,7 +6,7 @@ - 404 Page Not Found + <?= lang('Errors.pageNotFound') ?> ' /> asset('styles/index.css', 'css') ?> @@ -14,13 +14,13 @@ -

404 - File Not Found

+

404

- Sorry! Cannot seem to find the page you were looking for. +

diff --git a/app/Views/errors/html/error_exception.php b/app/Views/errors/html/error_exception.php index 99ce24a0..a50dfe81 100644 --- a/app/Views/errors/html/error_exception.php +++ b/app/Views/errors/html/error_exception.php @@ -1,6 +1,12 @@ - +declare(strict_types=1); + +use CodeIgniter\CodeIgniter; +use Config\Services; + +$errorId = uniqid('error', true); +?> @@ -8,11 +14,11 @@ $error_id = uniqid('error', true); ?> <?= esc($title) ?> - - @@ -79,16 +85,16 @@ $error_id = uniqid('error', true); ?>   —   - - ( arguments ) -
+ + ( arguments ) +
getParameters(); } @@ -191,7 +197,7 @@ $error_id = uniqid('error', true); ?>
- +
@@ -309,7 +315,7 @@ $error_id = uniqid('error', true); ?> setStatusCode(http_response_code()); ?>
@@ -334,11 +340,11 @@ $response->setStatusCode(http_response_code());
- $value) : ?> - - - - + + + + +
getHeaderLine($name), 'html') ?>
getHeaderLine($name), 'html') ?>
@@ -389,7 +395,7 @@ $response->setStatusCode(http_response_code());

Displayed at — PHP: — - CodeIgniter: + CodeIgniter:

diff --git a/app/Views/errors/html/production.php b/app/Views/errors/html/production.php index 0b6bc13b..65fcabb8 100644 --- a/app/Views/errors/html/production.php +++ b/app/Views/errors/html/production.php @@ -7,7 +7,7 @@ - Whoops! + <?= lang('Errors.whoops') ?> ' /> asset('styles/index.css', 'css') ?> loggedIn()): ?> @@ -21,8 +21,8 @@
-

Whoops!

-

We seem to have hit a snag. Please try again later...

+

+

getCode() ? ' #' . $exception->getCode() : '') ?>

diff --git a/composer.json b/composer.json index 6e747849..adf165d4 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "license": "AGPL-3.0-or-later", "require": { "php": "^8.1", - "codeigniter4/framework": "v4.2.12", + "codeigniter4/framework": "v4.3.6", "james-heinrich/getid3": "^2.0.0-beta5", "whichbrowser/parser": "^v2.1.7", "geoip2/geoip2": "v2.13.0", @@ -23,7 +23,7 @@ "chrisjean/php-ico": "^1.0.4", "melbahja/seo": "^v2.1.1", "codeigniter4/shield": "v1.0.0-beta.6", - "aws/aws-sdk-php": "^3.275.2", + "aws/aws-sdk-php": "^3.275.3", "mpratt/embera": "^2.0.34", "codeigniter4/tasks": "dev-develop", "yassinedoghri/podcast-feed": "dev-main" @@ -33,10 +33,15 @@ "phpunit/phpunit": "^10.2.3", "captainhook/captainhook": "^5.16.4", "symplify/easy-coding-standard": "^11.5.0", - "phpstan/phpstan": "^1.10.23", + "phpstan/phpstan": "^1.10.25", "rector/rector": "^0.17.2", "symplify/coding-standard": "^11.4.1" }, + "config": { + "optimize-autoloader": true, + "preferred-install": "dist", + "sort-packages": true + }, "autoload": { "exclude-from-classmap": [ "**/Database/Migrations/**" diff --git a/composer.lock b/composer.lock index a9e956de..966a9c85 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "658d8ad2579bb70845c1150757868314", + "content-hash": "50b45bbec65f3100f25ba9b161be7762", "packages": [ { "name": "adaures/ipcat-php", @@ -120,16 +120,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.275.2", + "version": "3.275.3", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "4506d631caf6097fd73009d57707e61b95efe92c" + "reference": "bbdf8e8d5df0b44ee83d5a751f316fc9f9dd2849" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/4506d631caf6097fd73009d57707e61b95efe92c", - "reference": "4506d631caf6097fd73009d57707e61b95efe92c", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/bbdf8e8d5df0b44ee83d5a751f316fc9f9dd2849", + "reference": "bbdf8e8d5df0b44ee83d5a751f316fc9f9dd2849", "shasum": "" }, "require": { @@ -205,9 +205,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.275.2" + "source": "https://github.com/aws/aws-sdk-php/tree/3.275.3" }, - "time": "2023-07-03T18:27:31+00:00" + "time": "2023-07-05T18:22:08+00:00" }, { "name": "brick/math", @@ -304,23 +304,22 @@ }, { "name": "codeigniter4/framework", - "version": "v4.2.12", + "version": "v4.3.6", "source": { "type": "git", "url": "https://github.com/codeigniter4/framework.git", - "reference": "bc3f312a3ebaf53394fa099b090b7a52a29375c2" + "reference": "e3921233a20daf05ae9d2b50ca41ce97748e1d6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/codeigniter4/framework/zipball/bc3f312a3ebaf53394fa099b090b7a52a29375c2", - "reference": "bc3f312a3ebaf53394fa099b090b7a52a29375c2", + "url": "https://api.github.com/repos/codeigniter4/framework/zipball/e3921233a20daf05ae9d2b50ca41ce97748e1d6d", + "reference": "e3921233a20daf05ae9d2b50ca41ce97748e1d6d", "shasum": "" }, "require": { "ext-intl": "*", "ext-json": "*", "ext-mbstring": "*", - "kint-php/kint": "^4.2", "laminas/laminas-escaper": "^2.9", "php": "^7.4 || ^8.0", "psr/log": "^1.1" @@ -329,6 +328,7 @@ "codeigniter/coding-standard": "^1.5", "fakerphp/faker": "^1.9", "friendsofphp/php-cs-fixer": "3.13.0", + "kint-php/kint": "^5.0.4", "mikey179/vfsstream": "^1.6", "nexusphp/cs-config": "^3.6", "phpunit/phpunit": "^9.1", @@ -370,7 +370,7 @@ "slack": "https://codeigniterchat.slack.com", "source": "https://github.com/codeigniter4/CodeIgniter4" }, - "time": "2023-01-09T06:53:50+00:00" + "time": "2023-06-17T23:13:38+00:00" }, { "name": "codeigniter4/settings", @@ -1189,63 +1189,6 @@ }, "time": "2022-10-28T11:52:26+00:00" }, - { - "name": "kint-php/kint", - "version": "4.2.3", - "source": { - "type": "git", - "url": "https://github.com/kint-php/kint.git", - "reference": "7601bfd95ccc50a1b903c2764b31d00919e8edd9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/kint-php/kint/zipball/7601bfd95ccc50a1b903c2764b31d00919e8edd9", - "reference": "7601bfd95ccc50a1b903c2764b31d00919e8edd9", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.0", - "phpspec/prophecy-phpunit": "^2", - "phpunit/phpunit": "^9.0", - "seld/phar-utils": "^1.0", - "symfony/finder": "^3.0 || ^4.0 || ^5.0", - "vimeo/psalm": "^4.0" - }, - "suggest": { - "kint-php/kint-helpers": "Provides extra helper functions", - "kint-php/kint-twig": "Provides d() and s() functions in twig templates" - }, - "type": "library", - "autoload": { - "files": ["init.php"], - "psr-4": { - "Kint\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": ["MIT"], - "authors": [ - { - "name": "Jonathan Vollebregt", - "homepage": "https://github.com/jnvsor" - }, - { - "name": "Contributors", - "homepage": "https://github.com/kint-php/kint/graphs/contributors" - } - ], - "description": "Kint - debugging tool for PHP developers", - "homepage": "https://kint-php.github.io/kint/", - "keywords": ["debug", "kint", "php"], - "support": { - "issues": "https://github.com/kint-php/kint/issues", - "source": "https://github.com/kint-php/kint/tree/4.2.3" - }, - "time": "2022-10-01T20:16:33+00:00" - }, { "name": "laminas/laminas-escaper", "version": "2.12.0", @@ -3610,16 +3553,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.20.0", + "version": "v3.21.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "0e8249e0b15e2bc022fbbd1090ce29d071481e69" + "reference": "229b55b3eae4729a8e2a321441ba40fcb3720b86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/0e8249e0b15e2bc022fbbd1090ce29d071481e69", - "reference": "0e8249e0b15e2bc022fbbd1090ce29d071481e69", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/229b55b3eae4729a8e2a321441ba40fcb3720b86", + "reference": "229b55b3eae4729a8e2a321441ba40fcb3720b86", "shasum": "" }, "require": { @@ -3629,7 +3572,7 @@ "doctrine/lexer": "^2 || ^3", "ext-json": "*", "ext-tokenizer": "*", - "php": "^7.4 || ^8.0", + "php": "^8.0.1", "sebastian/diff": "^4.0 || ^5.0", "symfony/console": "^5.4 || ^6.0", "symfony/event-dispatcher": "^5.4 || ^6.0", @@ -3690,7 +3633,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.20.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.21.1" }, "funding": [ { @@ -3698,7 +3641,7 @@ "type": "github" } ], - "time": "2023-06-27T20:22:39+00:00" + "time": "2023-07-05T21:50:25+00:00" }, { "name": "mikey179/vfsstream", @@ -3952,16 +3895,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.23", + "version": "1.10.25", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "65ab678d1248a8bc6fde456f0d7ff3562a61a4cd" + "reference": "578f4e70d117f9a90699324c555922800ac38d8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/65ab678d1248a8bc6fde456f0d7ff3562a61a4cd", - "reference": "65ab678d1248a8bc6fde456f0d7ff3562a61a4cd", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/578f4e70d117f9a90699324c555922800ac38d8c", + "reference": "578f4e70d117f9a90699324c555922800ac38d8c", "shasum": "" }, "require": { @@ -4000,7 +3943,7 @@ "type": "tidelift" } ], - "time": "2023-07-04T13:32:44+00:00" + "time": "2023-07-06T12:11:37+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/env b/env index 9dede2ea..cb99e19c 100644 --- a/env +++ b/env @@ -24,15 +24,6 @@ # If you have trouble with `.`, you could also use `_`. # app_baseURL = '' # app.forceGlobalSecureRequests = false - -# app.sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler' -# app.sessionCookieName = 'ci_session' -# app.sessionExpiration = 7200 -# app.sessionSavePath = null -# app.sessionMatchIP = false -# app.sessionTimeToUpdate = 300 -# app.sessionRegenerateDestroy = false - # app.CSPEnabled = false #-------------------------------------------------------------------- @@ -124,9 +115,21 @@ # security.cookieName = 'csrf_cookie_name' # security.expires = 7200 # security.regenerate = true -# security.redirect = true +# security.redirect = false # security.samesite = 'Lax' +#-------------------------------------------------------------------- +# SESSION +#-------------------------------------------------------------------- + +# session.driver = 'CodeIgniter\Session\Handlers\FileHandler' +# session.cookieName = 'ci_session' +# session.expiration = 7200 +# session.savePath = null +# session.matchIP = false +# session.timeToUpdate = 300 +# session.regenerateDestroy = false + #-------------------------------------------------------------------- # LOGGER #-------------------------------------------------------------------- diff --git a/phpstan.neon b/phpstan.neon index 0817a290..b5a2a9f5 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,7 @@ parameters: tmpDir: build/phpstan level: 6 + checkGenericClassInNonGenericObjectType: false paths: - app - tests diff --git a/public/.htaccess b/public/.htaccess index 9fe97382..35da1f1f 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -1,5 +1,5 @@ # Disable directory browsing -Options All -Indexes +Options -Indexes # ---------------------------------------------------------------------- # Rewrite engine diff --git a/public/index.php b/public/index.php index d8fe40cc..4e0739e5 100644 --- a/public/index.php +++ b/public/index.php @@ -53,7 +53,7 @@ require_once SYSTEMPATH . 'Config/DotEnv.php'; * --------------------------------------------------------------- * * The CodeIgniter class contains the core functionality to make - * the application run, and does all of the dirty work to get + * the application run, and does all the dirty work to get * the pieces all working together. */ @@ -66,7 +66,7 @@ $app->setContext($context); *--------------------------------------------------------------- * LAUNCH THE APPLICATION *--------------------------------------------------------------- - * Now that everything is setup, it's time to actually fire + * Now that everything is set up, it's time to actually fire * up the engines and make this app do its thang. */ diff --git a/spark b/spark index ceed30a1..75150a39 100644 --- a/spark +++ b/spark @@ -81,10 +81,9 @@ require_once SYSTEMPATH . 'Config/DotEnv.php'; // Grab our CodeIgniter $app = Config\Services::codeigniter(); $app->initialize(); -$app->setContext('spark'); // Grab our Console -$console = new CodeIgniter\CLI\Console($app); +$console = new CodeIgniter\CLI\Console(); // Show basic information before we do anything else. if (is_int($suppress = array_search('--no-header', $_SERVER['argv'], true))) { @@ -95,8 +94,6 @@ if (is_int($suppress = array_search('--no-header', $_SERVER['argv'], true))) { $console->showHeader($suppress); // fire off the command in the main framework. -$response = $console->run(); +$exit = $console->run(); -if ($response->getStatusCode() >= 300) { - exit($response->getStatusCode()); -} +exit(is_int($exit) ? $exit : EXIT_SUCCESS);