Skip to content

Commit b82cfc7

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.6
2 parents c2da959 + 971b0da commit b82cfc7

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
__DIR__ . '/.php-cs-fixer.no-header.php',
3737
__DIR__ . '/.php-cs-fixer.tests.php',
3838
__DIR__ . '/.php-cs-fixer.user-guide.php',
39+
__DIR__ . '/preload.php',
3940
__DIR__ . '/rector.php',
4041
__DIR__ . '/spark',
4142
]);

preload.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,6 @@
2929
// Path to the front controller
3030
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
3131

32-
/**
33-
* See https://www.php.net/manual/en/function.str-contains.php#126277
34-
*/
35-
if (! function_exists('str_contains')) {
36-
/**
37-
* Polyfill of str_contains()
38-
*/
39-
function str_contains(string $haystack, string $needle): bool
40-
{
41-
return empty($needle) || strpos($haystack, $needle) !== false;
42-
}
43-
}
44-
4532
class preload
4633
{
4734
/**
@@ -51,6 +38,7 @@ class preload
5138
[
5239
'include' => __DIR__ . '/vendor/codeigniter4/framework/system', // Change this path if using manual installation
5340
'exclude' => [
41+
'/system/bootstrap.php',
5442
// Not needed if you don't use them.
5543
'/system/Database/OCI8/',
5644
'/system/Database/Postgre/',
@@ -77,16 +65,18 @@ public function __construct()
7765
$this->loadAutoloader();
7866
}
7967

80-
private function loadAutoloader()
68+
private function loadAutoloader(): void
8169
{
8270
$paths = new Config\Paths();
83-
require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
71+
require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'Boot.php';
72+
73+
CodeIgniter\Boot::preload($paths);
8474
}
8575

8676
/**
8777
* Load PHP files.
8878
*/
89-
public function load()
79+
public function load(): void
9080
{
9181
foreach ($this->paths as $path) {
9282
$directory = new RecursiveDirectoryIterator($path['include']);

system/Boot.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,19 @@ public static function bootTest(Paths $paths): void
122122
static::autoloadHelpers();
123123
}
124124

125+
/**
126+
* Used by `preload.php`
127+
*/
128+
public static function preload(Paths $paths): void
129+
{
130+
static::definePathConstants($paths);
131+
static::loadConstants();
132+
static::defineEnvironment();
133+
static::loadEnvironmentBootstrap($paths, false);
134+
135+
static::loadAutoloader();
136+
}
137+
125138
/**
126139
* Load environment settings from .env files into $_SERVER and $_ENV
127140
*/

system/Security/CheckPhpIni.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,10 @@ public static function checkIni(): array
141141
$ini = ini_get_all();
142142

143143
foreach ($items as $key => $values) {
144+
$hasKeyInIni = array_key_exists($key, $ini);
144145
$output[$key] = [
145-
'global' => $ini[$key]['global_value'],
146-
'current' => $ini[$key]['local_value'],
146+
'global' => $hasKeyInIni ? $ini[$key]['global_value'] : 'disabled',
147+
'current' => $hasKeyInIni ? $ini[$key]['local_value'] : 'disabled',
147148
'recommended' => $values['recommended'] ?? '',
148149
'remark' => $values['remark'] ?? '',
149150
];

0 commit comments

Comments
 (0)