Version 4.1.2
Release Date: May 16, 2021
4.1.2 release of CodeIgniter4
BREAKING
Fixed a bug in current_url() that prevented
configurations with an indexPage from including that value in the return value. Any installations
using App::$indexPage should expect altered values from current_url() and all its dependencies
(including Response Testing, Pager, Form Helper, Pager, and View Parser).
Enhancements
New HTTP classes,
CookieandCookieStore, for abstracting web cookies.New
assertRedirectTo()assertion available for HTTP tests.New logger handler,
ErrorlogHandler, that writes toerror_log().Entity. Added custom type casting functionality.
New option in routing. The
priorityoption lower the priority of specific route processing.The
Autoloaderclass can now load files which do not contain PHP classes. The list of non-class files will be listed in the$filesproperty ofConfig\Autoloadclass.
Changes
Layouts in views now support nested sections.
Response::getCookienow returns aCookieinstance instead of an array of cookie attributes.Response::getCookiesnow returns an array ofCookieinstances instead of array of array of attributes.To eliminate warnings from modern browsers’ consoles, empty samesite values will be defaulted to
Laxon cookie dispatch.Model::errors() and BaseModel::errors() now always returns array; there was no definition change but the docblock has been updated.
Entity::castAshas changed behavior. Added new parameter$method. Type casting has been moved to separate handlers.Entity. Timestamp casting now throws an exception when an invalid value is passed
Entity::castAsJsonuses external cast handlerJsonCast::get.Entity::mutateDateuses external cast handlerDatetimeCast::get.In order for
Config\**classes to get their respective properties’ values from the.env, it is now necessary to namespace the property with the name of the class. Previously, the property names are enough but now disallowed because it can get system environment variables, likePATH.The array helper
_array_search_dotis now marked for@internaluse. As this is used bydot_array_search, users should not use_array_search_dotdirectly in their code.CacheInterface::getMetaData()returnsnullfor misses, or an array with at least the “expires” key set to the absolute epoch expiration, ornullfor “never expires”. The File, Memcached, and Wincache Handlers still returnfalsewhich will becomenullin a future release.
Deprecations
Deprecated
CodeIgniter\View\View::$currentSectionproperty.Language strings and exceptions on invalid cookie samesite are deprecated for the
CookieException’s own exception message.Deprecated CodeIgniterEntity in favor of CodeIgniterEntityEntity
Deprecated cookie-related properties of
Responsein order to use theCookieclass.Deprecated cookie-related properties of
Securityin order to use theCookieclass.Deprecated cookie-related properties of
Sessionin order to use theCookieclass.Deprecated
Security::isExpired()to use theCookie’s internal expires status.Deprecated
CIDatabaseTestCaseto use theDatabaseTestTraitinstead.Deprecated
FeatureTestCaseto use theFeatureTestTraitinstead.Deprecated
ControllerTesterto use theControllerTestTraitinstead.Consolidated and deprecated
ControllerResponseandFeatureResponsein favor ofTestResponse.Deprecated
Time::instance(), useTime::createFromInstance()instead (now acceptsDateTimeInterface).Deprecated
IncomingRequest::removeRelativeDirectory(), useURI::removeDotSegments()insteadDeprecated
\API\ResponseTrait::failValidationErrorto use\API\ResponseTrait::failValidationErrorsinstead
Bugs Fixed
BaseConnection::query()now returnsfalsefor failed queries (unlessDBDebug==true, in which case an exception will be thrown) and returns boolean values for write-type queries as specified in the docs.
See the repo’s CHANGELOG_4.1.md for a complete list of bugs fixed.