Release Date: Unreleased
4.5.0 release of CodeIgniter4
- Update minimal PHP requirement to 8.1.
- TBD
For historical reasons, the framework used HTTP method names in lower case like "get", "post". But the method token is case-sensitive because it might be used as a gateway to object-based systems with case-sensitive method names. By convention, standardized methods are defined in all-uppercase US-ASCII letters. See https://www.rfc-editor.org/rfc/rfc9110#name-overview.
Now the framework uses the correct HTTP method names like "GET", "POST".
Request::getMethod()
returns uppercase HTTP methods.CURLRequest::request()
does not change the accepted HTTP methods to uppercase.
See :ref:`upgrade-450-lowercase-http-method-name` for details.
The order in which Controller Filters are executed has changed. See :ref:`Upgrading Guide <upgrade-450-filter-execution-order>` for details.
Due to a bug fix, the behavior has changed so that options passed to the outer
group()
are merged with the options of the inner group()
.
See :ref:`Upgrading Guide <upgrade-450-nested-route-groups-and-options>` for details.
:doc:`../concepts/factories` has been changed to a final class. It is a static class, and even if it were extended, there is no way to replace it.
- AutoRouting Legacy: Changed so that a
PageNotFoundException
is thrown if the controller corresponding to the request URI does not exist. - Logger: The :php:func:`log_message()` function and the logger methods in
CodeIgniter\Log\Logger
now do not returnbool
values. The return types have been fixed tovoid
to follow the PSR-3 interface. - Autoloader: The prefix
\
in the fully qualified classname returned byFileLocator::findQualifiedNameFromPath()
has been removed. - BaseModel: The
getIdValue()
method has been changed toabstract
.
Note
As long as you have not extended the relevant CodeIgniter core classes or implemented these interfaces, all these changes are backward compatible and require no intervention.
- ResponseInterface: The default value of the third parameter
$expire
of theResponseInterface::setCookie()
has been fixed from''
to0
. - Logger: The psr/log package has been upgraded to v2.0.0.
The third parameter $expire
in :php:func:`set_cookie()` and
:php:meth:`CodeIgniter\\HTTP\\Response::setCookie()` has been fixed.
The type has been changed from string
to int
, and the default value has
been changed from ''
to 0
.
- Router: The first parameter of the
RouteCollection
constructor has been changed fromFileLocator
toFileLocatorInterface
. - View: The third parameter of the
View
constructor has been changed fromFileLocator
toFileLocatorInterface
.
- Model: The return type of the
objectToRawArray()
method in theModel
andBaseModel
classes has been changed from?array
toarray
.
To add declare(strict_types=1)
to the framework codebase, the method parameter
type ?string
for a value to validate in the all Traditional Validation rule
classes CodeIgniter\Validation\FormatRules
and CodeIgniter\Validation\Rules
are removed.
For example, the method signature changed as follows:
Before: public function integer(?string $str = null): bool After: public function integer($str = null): bool
- Logger: The method signatures of the methods in
CodeIgniter\Log\Logger
that implements the PSR-3 interface have been fixed. Thebool
return types are changed tovoid
. The$message
parameters now havestring|Stringable
types.
- The
$upper
parameter ingetMethod()
inRequestInterface
andRequest
has been removed. See :ref:`upgrade-450-lowercase-http-method-name`. - The deprecated
isValidIP()
method inRequestInterface
andRequest
has been removed. - The visibility of the deprecated properties
$uri
and$config
inIncomingRequest
has been changed to protected.
The following deprecated items have been removed, because now :ref:`multiple-filters` are always enabled.
Filters::enableFilter()
RouteCollection::getFilterForRoute()
Router::$filterInfo
Router::getFilter()
ModelFactory
BaseModel::idValue()
BaseModel::fillPlaceholders()
Model::idValue()
Model::classToArray()
The visibility of the deprecated property
ResponseTrait::$CSP
has been changed to protected.The following deprecated properties have been removed.
ResponseTrait::$CSPEnabled
ResponseTrait::$cookiePrefix
ResponseTrait::$cookieDomain
ResponseTrait::$cookiePath
ResponseTrait::$cookieSecure
ResponseTrait::$cookieHTTPOnly
ResponseTrait::$cookieSameSite
ResponseTrait::$cookies
$path
$useSafeOutput
useSafeOutput()
setPath()
CIDatabaseTestCase
ControllerResponse
ControllerTester
FeatureResponse
FeatureTestCase
migrate:create
session:migration
- Config: The deprecated
CodeIgniter\Config\Config
class has been removed.
- Added
spark config:check
command to check Config values. See :ref:`confirming-config-values` for the details. - Added
spark lang:find
command to update translations keys. See :ref:`generating-translation-files-via-command` for the details.
- DomParser: The new methods were added
seeXPath()
anddontSeeXPath()
which allows users to work directly with DOMXPath object, using complex expressions. - CLI: The new
InputOutput
class was added and now you can write tests for commands more easily if you useMockInputOutput
. See :ref:`using-mock-input-output`.
- Validation: Added the new rule
field_exists
that checks the filed exists in the data to be validated.
New :ref:`Required Filters <filters-required>` have been introduced. They are special filters that are applied before and after other kinds of filters, and always applied even if a route does not exist.
The following existing functionalities have been reimplemented as Required Filters.
- :ref:`Force Global Secure Requests <forcehttps>`
- :doc:`../general/caching`
- :ref:`performancemetrics`
- :ref:`the-debug-toolbar`
The Benchmark Timers used by Debug Toolbar now collect Required Before Filters and Required After Filters data.
The benchmark points have been changed:
Before
bootstrap
: Creating Request and Response objects, Eventpre_system
, Instantiating RouteCollection object, Loading Routes files, Instantiating Router object,routing
: Routing,
After
bootstrap
: Creating Request and Response objects, Eventpre_system
.required_before_filters
: Instantiating Filters object, Running Required Before Filters.routing
: Instantiating RouteCollection object, Loading Routes files, Instantiating Router object, Routing,
- Autoloader:
- Autoloading performance when using Composer has been improved.
Adding the
App
namespace in theautoload.psr4
setting in composer.json may also improve the performance of your app. See :ref:`autoloader-application-namespace`. - FileLocator Caching implemented. See :ref:`file-locator-caching` for details.
FileLocatorInterface
has been added.
- Autoloading performance when using Composer has been improved.
Adding the
- CodeIgniter: Added a pseudo-variable
{memory_usage}
to show your memory usage in your view files, which was supported by CodeIgniter 3. - CSP: Added
ContentSecurityPolicy::clearDirective()
method to clear existing CSP directives. See :ref:`csp-clear-directives`. - HTTP: Added
Message::addHeader()
method to add another header with the same name. See :php:meth:`CodeIgniter\\HTTP\\Message::addHeader()`.
- Added
Validation.field_exists
error message.
- Config:
Config\Feature::$multipleFilters
has been removed, because now :ref:`multiple-filters` are always enabled.
- CodeIgniter: The
determinePath()
method has been deprecated. No longer used. - Response: The constructor parameter
$config
has been deprecated. No longer used. - Filters:: The feature that
Filters
accept the lowercase HTTP method keys ofConfig\Filters::$methods
has been deprecated. Use correct uppercase HTTP method keys instead. - RouteCollection: The feature that the
match()
method accepts the lowercase HTTP methods has been deprecated. Use correct uppercase HTTP methods instead. - FeatureTestTrait: The feature that the
withRoutes()
method accepts the lowercase HTTP methods has been deprecated. Use correct uppercase HTTP methods instead.
See the repo's CHANGELOG.md for a complete list of bugs fixed.