Version 4.0.5¶
Release Date: January 31, 2021
4.0.5 release of CodeIgniter4
Enhancements¶
- New URL helper function
url_to()which creates absolute URLs based on controllers. - New Model option:
$useAutoIncrementwhich when set tofalseallows you to provide your own primary key for each record in the table. Handy when we want to implement a 1:1 relation or use UUIDs for our model. - New URL helper function
url_is()which allows you to check the current URL to see if it matches the given string. - Services now have their config parameters strictly typehinted. This will ensure no one will pass a different config instance. If you need to pass a new config with additional properties, you need to extend that particular config.
- Support for setting the SameSite attribute on Session and CSRF cookies has been added. For security and compatibility with the latest browser versions, the default setting is
Lax. - Guessing file extensions from mime type in
Config\Mimes::guessExtensionFromType()now only reverse searches the$mimesarray if no extension is proposed (i.e., usually not for uploaded files). - The getter functions for file extensions of uploaded files now have different fallback values (
UploadedFile::getClientExtension()forUploadedFile::getExtension()and''forUploadedFile::guessExtension()). This is a security fix and makes the process less dependent on the client. - The Cache
FileHandlernow allows setting the file permissions mode viaConfig\Cache.
Changes¶
- System messages defined in system/Language/en/ are now strictly for internal framework use and are not covered by the backwards compatibility (BC) promise. Users may use these messages in their applications but at their own risk.
Deprecations¶
- Deprecated
BaseCommand::getPad()in favor ofBaseCommand::setPad(). - Deprecated
CodeIgniter\Controller::loadHelpers()in favor of thehelper()function. - Deprecated
Config\Format::getFormatter()in favor ofCodeIgniter\Format\Format::getFormatter() - Deprecated
CodeIgniter\Security\Security::CSRFVerify()in favor ofCodeIgniter\Security\Security::verify() - Deprecated
CodeIgniter\Security\Security::getCSRFHash()in favor ofCodeIgniter\Security\Security::getHash() - Deprecated
CodeIgniter\Security\Security::getCSRTokenName()in favor ofCodeIgniter\Security\Security::getTokenName() - Deprecated
Config\App::$CSRFTokenNamein favor ofConfig\Security::$tokenName - Deprecated
Config\App::$CSRFHeaderNamein favor ofConfig\Security::$headerName - Deprecated
Config\App::$CSRFCookieNamein favor ofConfig\Security::$cookieName - Deprecated
Config\App::$CSRFExpirein favor ofConfig\Security::$expire - Deprecated
Config\App::$CSRFRegeneratein favor ofConfig\Security::$regenerate - Deprecated
Config\App::$CSRFRedirectin favor ofConfig\Security::$redirect - Deprecated
Config\App::$CSRFSameSitein favor ofConfig\Security::$samesite - Deprecated the
migrate:createcommand in favor of themake:migrationcommand. - Deprecated
CodeIgniter\Database\ModelFactoryin favor ofCodeIgniter\Config\Factories::models() - Deprecated
CodeIgniter\Config\Configin favor ofCodeIgniter\Config\Factories::config() - Deprecated
CodeIgniter\HTTP\Message::getHeader()in favor ofheader()to prepare for PSR-7 - Deprecated
CodeIgniter\HTTP\Message::getHeaders()in favor ofheaders()to prepare for PSR-7 - Deprecated
Config\Cache::$storePathin favor ofConfig\Cache::$file['storePath']
Bugs Fixed¶
- Fixed a bug in the
Entityclass where declaring class parameters was preventing data propagation to theattributesarray. - Handling for the environment variable
encryption.keyhas changed. Previously, explicit function calls, likegetenv('encryption.key')orenv('encryption.key')where the value has the special prefixhex2bin:, returned an automatically converted binary string. These calls now return the character string with the prefix. This change was due to incompatibility with handling binary strings in environment variables on Windows platforms. However, accessing$keyusing theEncryptionclass config remains unchanged and still returns a binary string. Config\Services(in app/Config/Services.php) now extendsCodeIgniter\Config\BaseServiceto allow proper discovery of third-party services.
See the repo's CHANGELOG_4.0.md for a complete list of bugs fixed.