Skip to content

Commit 5b34d72

Browse files
committed
Release v4.1.6
1 parent 27eb447 commit 5b34d72

File tree

177 files changed

+2853
-1428
lines changed

Some content is hidden

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

177 files changed

+2853
-1428
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The MIT License (MIT)
22

33
Copyright (c) 2014-2019 British Columbia Institute of Technology
4-
Copyright (c) 2019-2021 CodeIgniter Foundation
4+
Copyright (c) 2019-2022 CodeIgniter Foundation
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal

app/Config/Filters.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use CodeIgniter\Filters\CSRF;
77
use CodeIgniter\Filters\DebugToolbar;
88
use CodeIgniter\Filters\Honeypot;
9+
use CodeIgniter\Filters\InvalidChars;
10+
use CodeIgniter\Filters\SecureHeaders;
911

1012
class Filters extends BaseConfig
1113
{
@@ -16,9 +18,11 @@ class Filters extends BaseConfig
1618
* @var array
1719
*/
1820
public $aliases = [
19-
'csrf' => CSRF::class,
20-
'toolbar' => DebugToolbar::class,
21-
'honeypot' => Honeypot::class,
21+
'csrf' => CSRF::class,
22+
'toolbar' => DebugToolbar::class,
23+
'honeypot' => Honeypot::class,
24+
'invalidchars' => InvalidChars::class,
25+
'secureheaders' => SecureHeaders::class,
2226
];
2327

2428
/**
@@ -31,10 +35,12 @@ class Filters extends BaseConfig
3135
'before' => [
3236
// 'honeypot',
3337
// 'csrf',
38+
// 'invalidchars',
3439
],
3540
'after' => [
3641
'toolbar',
3742
// 'honeypot',
43+
// 'secureheaders',
3844
],
3945
];
4046

app/Config/Mimes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ public static function guessExtensionFromType(string $type, ?string $proposedExt
509509
{
510510
$type = trim(strtolower($type), '. ');
511511

512-
$proposedExtension = trim(strtolower($proposedExtension));
512+
$proposedExtension = trim(strtolower($proposedExtension ?? ''));
513513

514514
if ($proposedExtension !== '') {
515515
if (array_key_exists($proposedExtension, static::$mimes) && in_array($type, is_string(static::$mimes[$proposedExtension]) ? [static::$mimes[$proposedExtension]] : static::$mimes[$proposedExtension], true)) {

app/Config/Security.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ class Security extends BaseConfig
1717
*/
1818
public $csrfProtection = 'cookie';
1919

20+
/**
21+
* --------------------------------------------------------------------------
22+
* CSRF Token Randomization
23+
* --------------------------------------------------------------------------
24+
*
25+
* Randomize the CSRF Token for added security.
26+
*
27+
* @var bool
28+
*/
29+
public $tokenRandomize = false;
30+
2031
/**
2132
* --------------------------------------------------------------------------
2233
* CSRF Token Name

app/Config/Toolbar.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ class Toolbar extends BaseConfig
4444
Events::class,
4545
];
4646

47+
/**
48+
* --------------------------------------------------------------------------
49+
* Collect Var Data
50+
* --------------------------------------------------------------------------
51+
*
52+
* If set to false var data from the views will not be colleted. Usefull to
53+
* avoid high memory usage when there are lots of data passed to the view.
54+
*
55+
* @var bool
56+
*/
57+
public $collectVarData = true;
58+
4759
/**
4860
* --------------------------------------------------------------------------
4961
* Max History

app/Views/errors/html/error_exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
<tbody>
196196
<tr>
197197
<td style="width: 10em">Path</td>
198-
<td><?= esc($request->uri) ?></td>
198+
<td><?= esc($request->getUri()) ?></td>
199199
</tr>
200200
<tr>
201201
<td>HTTP Method</td>

env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
#--------------------------------------------------------------------
112112

113113
# security.csrfProtection = 'cookie'
114+
# security.tokenRandomize = false
114115
# security.tokenName = 'csrf_token_name'
115116
# security.headerName = 'X-CSRF-TOKEN'
116117
# security.cookieName = 'csrf_cookie_name'

system/Autoloader/Autoloader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ public function initialize(Autoload $config, Modules $modules)
114114
public function register()
115115
{
116116
// Prepend the PSR4 autoloader for maximum performance.
117-
spl_autoload_register([$this, 'loadClass'], true, true); // @phpstan-ignore-line
117+
spl_autoload_register([$this, 'loadClass'], true, true);
118118

119119
// Now prepend another loader for the files in our class map.
120-
spl_autoload_register([$this, 'loadClassmap'], true, true); // @phpstan-ignore-line
120+
spl_autoload_register([$this, 'loadClassmap'], true, true);
121121

122122
// Load our non-class files
123123
foreach ($this->files as $file) {

system/Autoloader/FileLocator.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function locateFile(string $file, ?string $folder = null, string $ext = '
5555

5656
// Standardize slashes to handle nested directories.
5757
$file = strtr($file, '/', '\\');
58+
$file = ltrim($file, '\\');
5859

5960
$segments = explode('\\', $file);
6061

@@ -64,23 +65,20 @@ public function locateFile(string $file, ?string $folder = null, string $ext = '
6465
}
6566

6667
$paths = [];
67-
$prefix = '';
6868
$filename = '';
6969

7070
// Namespaces always comes with arrays of paths
7171
$namespaces = $this->autoloader->getNamespace();
7272

73-
while (! empty($segments)) {
74-
$prefix .= empty($prefix) ? array_shift($segments) : '\\' . array_shift($segments);
73+
foreach (array_keys($namespaces) as $namespace) {
74+
if (substr($file, 0, strlen($namespace)) === $namespace) {
75+
// There may be sub-namespaces of the same vendor,
76+
// so overwrite them with namespaces found later.
77+
$paths = $namespaces[$namespace];
7578

76-
if (empty($namespaces[$prefix])) {
77-
continue;
79+
$fileWithoutNamespace = substr($file, strlen($namespace));
80+
$filename = ltrim(str_replace('\\', '/', $fileWithoutNamespace), '/');
7881
}
79-
80-
$paths = $namespaces[$prefix];
81-
82-
$filename = implode('/', $segments);
83-
break;
8482
}
8583

8684
// if no namespaces matched then quit

system/BaseModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@ protected function transformDataToArray($data, string $type): array
15781578
// properties representing the collection elements, we need to grab
15791579
// them as an array.
15801580
if (is_object($data) && ! $data instanceof stdClass) {
1581-
$data = $this->objectToArray($data, true, true);
1581+
$data = $this->objectToArray($data, ($type === 'update'), true);
15821582
}
15831583

15841584
// If it's still a stdClass, go ahead and convert to

0 commit comments

Comments
 (0)