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, 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 lowers the priority of specific route processing. - The
Autoloaderclass can now load files which do not contain PHP classes. The non-class files are listed in the$filesproperty of theConfig\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 an array of arrays of attributes.- To eliminate warnings from modern browsers' consoles, empty samesite values will be defaulted to
Laxon cookie dispatch. Model::errors()andBaseModel::errors()now always returnarray; 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 were enough, but this is 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 for invalid cookie samesite values are deprecated in favor of
CookieException's own exception message. - Deprecated
CodeIgniter\Entityin favor ofCodeIgniter\Entity\Entity - 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()in favor ofCookie's internal expiration 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()instead - Deprecated
\API\ResponseTrait::failValidationError()to use\API\ResponseTrait::failValidationErrors()instead
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.