Skip to content

Commit 29f0e9e

Browse files
committed
Release v4.2.0
1 parent 4ec623a commit 29f0e9e

File tree

200 files changed

+9168
-3565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+9168
-3565
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/
4343

4444
## Server Requirements
4545

46-
PHP version 7.3 or higher is required, with the following extensions installed:
46+
PHP version 7.4 or higher is required, with the following extensions installed:
4747

4848
- [intl](http://php.net/manual/en/intl.requirements.php)
4949
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library

app/Config/App.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Config;
44

55
use CodeIgniter\Config\BaseConfig;
6+
use CodeIgniter\Session\Handlers\FileHandler;
67

78
class App extends BaseConfig
89
{
@@ -151,7 +152,7 @@ class App extends BaseConfig
151152
*
152153
* @var string
153154
*/
154-
public $sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler';
155+
public $sessionDriver = FileHandler::class;
155156

156157
/**
157158
* --------------------------------------------------------------------------
@@ -318,7 +319,7 @@ class App extends BaseConfig
318319
* (empty string) means default SameSite attribute set by browsers (`Lax`)
319320
* will be set on cookies. If set to `None`, `$cookieSecure` must also be set.
320321
*
321-
* @var string
322+
* @var string|null
322323
*
323324
* @deprecated use Config\Cookie::$samesite property instead.
324325
*/
@@ -436,7 +437,7 @@ class App extends BaseConfig
436437
* Defaults to `Lax` as recommended in this link:
437438
*
438439
* @see https://portswigger.net/web-security/csrf/samesite-cookies
439-
* @deprecated Use `Config\Security` $samesite property instead of using this property.
440+
* @deprecated `Config\Cookie` $samesite property is used.
440441
*
441442
* @var string
442443
*/

app/Config/Constants.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
defined('HOUR') || define('HOUR', 3600);
3939
defined('DAY') || define('DAY', 86400);
4040
defined('WEEK') || define('WEEK', 604800);
41-
defined('MONTH') || define('MONTH', 2592000);
42-
defined('YEAR') || define('YEAR', 31536000);
43-
defined('DECADE') || define('DECADE', 315360000);
41+
defined('MONTH') || define('MONTH', 2_592_000);
42+
defined('YEAR') || define('YEAR', 31_536_000);
43+
defined('DECADE') || define('DECADE', 315_360_000);
4444

4545
/*
4646
| --------------------------------------------------------------------------
@@ -77,3 +77,18 @@
7777
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
7878
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
7979
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
80+
81+
/**
82+
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
83+
*/
84+
define('EVENT_PRIORITY_LOW', 200);
85+
86+
/**
87+
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
88+
*/
89+
define('EVENT_PRIORITY_NORMAL', 100);
90+
91+
/**
92+
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
93+
*/
94+
define('EVENT_PRIORITY_HIGH', 10);

app/Config/ContentSecurityPolicy.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,25 @@ class ContentSecurityPolicy extends BaseConfig
164164
* @var string|string[]|null
165165
*/
166166
public $sandbox;
167+
168+
/**
169+
* Nonce tag for style
170+
*
171+
* @var string
172+
*/
173+
public $styleNonceTag = '{csp-style-nonce}';
174+
175+
/**
176+
* Nonce tag for script
177+
*
178+
* @var string
179+
*/
180+
public $scriptNonceTag = '{csp-script-nonce}';
181+
182+
/**
183+
* Replace nonce tag automatically
184+
*
185+
* @var bool
186+
*/
187+
public $autoNonce = true;
167188
}

app/Config/Database.php

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,24 @@ class Database extends Config
5757
* @var array
5858
*/
5959
public $tests = [
60-
'DSN' => '',
61-
'hostname' => '127.0.0.1',
62-
'username' => '',
63-
'password' => '',
64-
'database' => ':memory:',
65-
'DBDriver' => 'SQLite3',
66-
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
67-
'pConnect' => false,
68-
'DBDebug' => (ENVIRONMENT !== 'production'),
69-
'charset' => 'utf8',
70-
'DBCollat' => 'utf8_general_ci',
71-
'swapPre' => '',
72-
'encrypt' => false,
73-
'compress' => false,
74-
'strictOn' => false,
75-
'failover' => [],
76-
'port' => 3306,
60+
'DSN' => '',
61+
'hostname' => '127.0.0.1',
62+
'username' => '',
63+
'password' => '',
64+
'database' => ':memory:',
65+
'DBDriver' => 'SQLite3',
66+
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
67+
'pConnect' => false,
68+
'DBDebug' => (ENVIRONMENT !== 'production'),
69+
'charset' => 'utf8',
70+
'DBCollat' => 'utf8_general_ci',
71+
'swapPre' => '',
72+
'encrypt' => false,
73+
'compress' => false,
74+
'strictOn' => false,
75+
'failover' => [],
76+
'port' => 3306,
77+
'foreignKeys' => true,
7778
];
7879

7980
public function __construct()

app/Config/Events.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
ob_end_flush();
3333
}
3434

35-
ob_start(static function ($buffer) {
36-
return $buffer;
37-
});
35+
ob_start(static fn ($buffer) => $buffer);
3836
}
3937

4038
/*

app/Config/Feature.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class Feature extends BaseConfig
1111
{
1212
/**
13-
* Enable multiple filters for a route or not
13+
* Enable multiple filters for a route or not.
1414
*
1515
* If you enable this:
1616
* - CodeIgniter\CodeIgniter::handleRequest() uses:
@@ -24,4 +24,9 @@ class Feature extends BaseConfig
2424
* @var bool
2525
*/
2626
public $multipleFilters = false;
27+
28+
/**
29+
* Use improved new auto routing instead of the default legacy version.
30+
*/
31+
public bool $autoRoutesImproved = false;
2732
}

app/Config/Filters.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ class Filters extends BaseConfig
4949
* particular HTTP method (GET, POST, etc.).
5050
*
5151
* Example:
52-
* 'post' => ['csrf', 'throttle']
52+
* 'post' => ['foo', 'bar']
53+
*
54+
* If you use this, you should disable auto-routing because auto-routing
55+
* permits any HTTP method to access a controller. Accessing the controller
56+
* with a method you don’t expect could bypass the filter.
5357
*
5458
* @var array
5559
*/

app/Config/Format.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use CodeIgniter\Config\BaseConfig;
66
use CodeIgniter\Format\FormatterInterface;
7+
use CodeIgniter\Format\JSONFormatter;
8+
use CodeIgniter\Format\XMLFormatter;
79

810
class Format extends BaseConfig
911
{
@@ -40,9 +42,9 @@ class Format extends BaseConfig
4042
* @var array<string, string>
4143
*/
4244
public $formatters = [
43-
'application/json' => 'CodeIgniter\Format\JSONFormatter',
44-
'application/xml' => 'CodeIgniter\Format\XMLFormatter',
45-
'text/xml' => 'CodeIgniter\Format\XMLFormatter',
45+
'application/json' => JSONFormatter::class,
46+
'application/xml' => XMLFormatter::class,
47+
'text/xml' => XMLFormatter::class,
4648
];
4749

4850
/**

app/Config/Logger.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Config;
44

5+
use CodeIgniter\Log\Handlers\FileHandler;
56
use CodeIgniter\Config\BaseConfig;
67

78
class Logger extends BaseConfig
@@ -83,7 +84,7 @@ class Logger extends BaseConfig
8384
* File Handler
8485
* --------------------------------------------------------------------
8586
*/
86-
'CodeIgniter\Log\Handlers\FileHandler' => [
87+
FileHandler::class => [
8788

8889
// The log levels that this handler will handle.
8990
'handles' => [

0 commit comments

Comments
 (0)