Skip to content

Latest commit

 

History

History
243 lines (199 loc) · 14.3 KB

File metadata and controls

243 lines (199 loc) · 14.3 KB

Version 4.8.0

Release Date: Unreleased

4.8.0 release of CodeIgniter4

  • TBD
  • Commands: The filter:check command now requires the HTTP method argument to be uppercase (e.g., spark filter:check GET / instead of spark filter:check get /).
  • Database: The Postgre driver's $db->error()['code'] previously always returned ''. It now returns the 5-character SQLSTATE string for query and transaction failures (e.g., '42P01'), or '08006' for connection-level failures. Code that relied on $db->error()['code'] === '' will need updating.
  • Filters: HTTP method matching for method-based filters is now case-sensitive. The keys in Config\Filters::$methods must exactly match the request method
    (e.g., GET, POST). Lowercase method names (e.g., post) will no longer match.
  • Testing: Tests using the FeatureTestTrait must now use uppercase HTTP method names when performing a request when using the call() method directly
    (e.g., $this->call('GET', '/path') instead of $this->call('get', '/path')). Additionally, setting method-based routes using withRoutes() must also use uppercase method names (e.g., $this->withRoutes([['GET', 'home', 'Home::index']])).
NOTE: If you've implemented your own classes that implement these interfaces from scratch, you will need to
update your implementations to include the new methods or method changes to ensure compatibility.
  • Logging: CodeIgniter\Log\Handlers\HandlerInterface::handle() now requires a third parameter array $context = []. Any custom log handler that overrides handle() - whether implementing HandlerInterface directly or extending a built-in handler class - must add the parameter to its handle() method signature.
  • Security: The SecurityInterface's verify() method now has a native return type of static.
  • CodeIgniter: The deprecated parameters in methods have been removed:
    • CodeIgniter\CodeIgniter::handleRequest() no longer accepts the deprecated $cacheConfig and $returnResponse parameters.
      • $cacheConfig is no longer used and is now hard deprecated. A deprecation notice will be triggered if this is passed to the method.
      • $returnResponse is now removed since already deprecated and unused.
      • The updated method signature is now handleRequest(?RouteCollectionInterface $routes, ?Cache $cacheConfig = null).
    • CodeIgniter\CodeIgniter::gatherOutput() no longer accepts the deprecated $cacheConfig parameter.
      As this is the first parameter, custom uses of this method will need to be updated to remove the parameter.
  • Config: CodeIgniter\Config\Services::request() no longer accepts any parameter.
  • Database: The following methods have had their signatures updated to remove deprecated parameters:
    • CodeIgniter\Database\Forge::_createTable() no longer accepts the deprecated $ifNotExists parameter. The method signature is now _createTable(string $table, array $attributes).
  • Autoloader: Removed the following deprecated methods:
    • CodeIgniter\Autoloader\Autoloader::sanitizeFileName()
    • CodeIgniter\Autoloader\Autoloader::discoverComposerNamespaces()
  • Bootstrap: The deprecated system/bootstrap.php file has been removed.
  • Cache: Removed the following deprecated methods and constant:
    • CodeIgniter\Cache\Handlers\BaseHandler::RESERVED_CHARACTERS (deprecated since v4.1.5)
    • CodeIgniter\Cache\Handlers\FileHandler::writeFile() (deprecated since v4.6.0)
    • CodeIgniter\Cache\Handlers\FileHandler::deleteFile() (deprecated since v4.6.0)
    • CodeIgniter\Cache\Handlers\FileHandler::getDirFileInfo() (deprecated since v4.6.0)
    • CodeIgniter\Cache\Handlers\FileHandler::getFileInfo() (deprecated since v4.6.0)
  • CLI: Removed the following properties and methods deprecated:
    • CodeIgniter\CLI\BaseCommand::getPad()
    • CodeIgniter\CLI\CLI::$readline_support
    • CodeIgniter\CLI\CLI::$wait_msg
    • CodeIgniter\CLI\CLI::isWindows()
    • CodeIgniter\CLI\GeneratorTrait::execute()
  • CodeIgniter: Removed the following properties and methods deprecated:
    • CodeIgniter\CodeIgniter::$cacheTTL
    • CodeIgniter\CodeIgniter::$returnResponse
    • CodeIgniter\CodeIgniter::initializeKint()
    • CodeIgniter\CodeIgniter::detectEnvironment()
    • CodeIgniter\CodeIgniter::bootstrapEnvironment()
    • CodeIgniter\CodeIgniter::forceSecureAccess()
    • CodeIgniter\CodeIgniter::displayCache()
    • CodeIgniter\CodeIgniter::cache()
    • CodeIgniter\CodeIgniter::cachePage()
    • CodeIgniter\CodeIgniter::generateCacheName()
    • CodeIgniter\CodeIgniter::displayPerformanceMetrics()
    • CodeIgniter\CodeIgniter::determinePath()
    • CodeIgniter\CodeIgniter::callExit()
    • CodeIgniter\Test\MockCodeIgniter::callExit()
  • Config: Removed the following property deprecated:
    • CodeIgniter\Config\BaseService::$services (deprecated since v4.5.0)
  • Database: Removed the following properties and methods deprecated:
    • CodeIgniter\Database\BaseBuilder::setInsertBatch()
    • CodeIgniter\Database\BaseBuilder::setUpdateBatch()
    • CodeIgniter\Database\BaseBuilder::cleanClone()
    • CodeIgniter\Database\BaseConnection::$strictOn
    • CodeIgniter\Database\Forge::$createTableIfStr
    • CodeIgniter\Database\Seeder::$faker
    • CodeIgniter\Database\Seeder::faker()
    • CodeIgniter\Database\OCI8\Forge::$createTableIfStr
    • CodeIgniter\Database\OCI8\Forge::getError()
    • CodeIgniter\Database\SQLSRV\Forge::$createTableIfStr
  • Debug: Removed the following deprecated properties and methods:
    • CodeIgniter\Debug\Toolbar\Collectors\BaseCollector::cleanPath() (deprecated since v4.2.0)
    • CodeIgniter\Debug\Exceptions::$ob_level (deprecated since v4.4.0)
    • CodeIgniter\Debug\Exceptions::$viewPath (deprecated since v4.4.0)
    • CodeIgniter\Debug\Exceptions::determineView() (deprecated since v4.4.0)
    • CodeIgniter\Debug\Exceptions::render() (deprecated since v4.4.0)
    • CodeIgniter\Debug\Exceptions::collectVars() (deprecated since v4.4.0)
    • CodeIgniter\Debug\Exceptions::maskSensitiveData() (deprecated since v4.4.0)
    • CodeIgniter\Debug\Exceptions::maskData() (deprecated since v4.4.0)
    • CodeIgniter\Debug\Exceptions::cleanPath() (deprecated since v4.2.0)
    • CodeIgniter\Debug\Exceptions::describeMemory() (deprecated since v4.4.0)
    • CodeIgniter\Debug\Exceptions::highlightFile() (deprecated since v4.4.0)
  • Exceptions: Removed the following static constructors of FrameworkException and its child classes:
    • CodeIgniter\Exceptions\DownloadException::forCannotSetCache()
    • CodeIgniter\Exceptions\FrameworkException::forMissingExtension()
    • CodeIgniter\Honeypot\Exceptions\HoneypotException::forNoHiddenValue()
    • CodeIgniter\HTTP\Exceptions\HTTPException::forInvalidSameSiteSetting()
    • CodeIgniter\Security\Exceptions\SecurityException::forInvalidSameSite()
    • CodeIgniter\Session\Exceptions\SessionException::forInvalidSameSiteSetting()
  • Filters: Removed the following properties and methods deprecated:
    • CodeIgniter\Filters\Filters::$arguments (deprecated since v4.6.0)
    • CodeIgniter\Filters\Filters::$argumentsClass (deprecated since v4.6.0)
    • CodeIgniter\Filters\Filters::getArguments() (deprecated since v4.6.0)
  • Security: Removed the following properties and methods deprecated:
    • CodeIgniter\Security\SecurityInterface::sanitizeFilename() (deprecated since v4.6.2)
    • CodeIgniter\Security\Security::sanitizeFilename() (deprecated since v4.6.2)
    • CodeIgniter\Security\Security::$csrfProtection (deprecated since v4.4.0)
    • CodeIgniter\Security\Security::$tokenRandomize (deprecated since v4.4.0)
    • CodeIgniter\Security\Security::$tokenName (deprecated since v4.4.0)
    • CodeIgniter\Security\Security::$headerName (deprecated since v4.4.0)
    • CodeIgniter\Security\Security::$expires (deprecated since v4.4.0)
    • CodeIgniter\Security\Security::$regenerate (deprecated since v4.4.0)
    • CodeIgniter\Security\Security::$redirect (deprecated since v4.4.0)
    • CodeIgniter\Security\Security::$sameSite (deprecated since v4.4.0)
  • CLI now supports the -- separator to mean that what follows are arguments, not options. This allows you to have arguments that start with - without them being treated as options.
    For example: spark my:command -- --myarg will pass --myarg as an argument instead of an option.
  • CLI now supports options with values specified using an equals sign (e.g., --option=value) in addition to the existing space-separated syntax (e.g., --option value).
    This provides more flexibility in how you can pass options to commands.
  • Added trustServerCertificate option to SQLSRV database connections in Config\Database. Set it to true to trust the server certificate without CA validation when using encrypted connections.
  • Added new chunkRows() method to CodeIgniter\Model for processing large datasets in smaller chunks.
  • Added new firstOrInsert() method to CodeIgniter\Model that finds the first row matching the given attributes or inserts a new one. See :ref:`model-first-or-insert`.
  • Context: This new feature allows you to easily set and retrieve normal or hidden contextual data for the current request. See :ref:`Context <context>` for details.
  • Images:: Added support for the AVIF file format.
  • Logging: Log handlers now receive the full context array as a third argument to handle(). When $logGlobalContext is enabled, the CI global context is available under the HandlerInterface::GLOBAL_CONTEXT_KEY key. Built-in handlers append it to the log output; custom handlers can use it for structured logging.
  • Logging: Added :ref:`per-call context logging <logging-per-call-context>` with three new Config\Logger options ($logContext, $logContextTrace, $logContextUsedKeys). Per PSR-3, a Throwable in the exception context key is automatically normalized to a meaningful array. All options default to false.
  • Added SSEResponse class for streaming Server-Sent Events (SSE) over HTTP. See :ref:`server-sent-events`.
  • Response and its child classes no longer require Config\App passed to their constructors.
    Consequently, CURLRequest's $config parameter is unused and will be removed in a future release.
  • CLIRequest now supports the -- separator to mean that what follows are arguments, not options. This allows you to have arguments that start with - without them being treated as options.
    For example: php index.php command -- --myarg will pass --myarg as an argument instead of an option.
  • CLIRequest now supports options with values specified using an equals sign (e.g., --option=value) in addition to the existing space-separated syntax (e.g., --option value).
    This provides more flexibility in how you can pass options to CLI requests.
  • Custom rule methods that set an error via the &$error reference parameter now support the {field}, {param}, and {value} placeholders, consistent with language-file and setRule()/setRules() error messages.
  • Removed deprecated language keys tied to removed exception constructors:
    • Core.missingExtension (FrameworkException::forMissingExtension())
    • HTTP.cannotSetCache (DownloadException::forCannotSetCache())
    • HTTP.invalidSameSiteSetting (HTTPException::forInvalidSameSiteSetting())
    • Security.invalidSameSite (SecurityException::forInvalidSameSite())
    • Session.invalidSameSiteSetting (SessionException::forInvalidSameSiteSetting())
  • Config: Added the md key for Config\Mimes::$mimes for Markdown files.
  • CLI: The CLI::parseCommandLine() method is now deprecated and will be removed in a future release. The CLI class now uses the new CommandLineParser class to handle command-line argument parsing.
  • HTTP: The CLIRequest::parseCommand() method is now deprecated and will be removed in a future release. The CLIRequest class now uses the new CommandLineParser class to handle command-line argument parsing.

See the repo's CHANGELOG.md for a complete list of bugs fixed.