Skip to content

Commit 0565572

Browse files
committed
Patch framework to 4.2.0
1 parent d5dba60 commit 0565572

24 files changed

+807
-695
lines changed

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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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/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' => [

app/Config/Mimes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ class Mimes
260260
'image/png',
261261
'image/x-png',
262262
],
263+
'webp' => 'image/webp',
263264
'tif' => 'image/tiff',
264265
'tiff' => 'image/tiff',
265266
'css' => [

app/Config/Publisher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ class Publisher extends BasePublisher
2323
*/
2424
public $restrictions = [
2525
ROOTPATH => '*',
26-
FCPATH => '#\.(?css|js|map|htm?|xml|json|webmanifest|tff|eot|woff?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
26+
FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
2727
];
2828
}

0 commit comments

Comments
 (0)