Skip to content

Commit 163f111

Browse files
committed
Release v4.5.2
1 parent 9b2cd73 commit 163f111

Some content is hidden

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

59 files changed

+285
-137
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ PHP version 8.1 or higher is required, with the following extensions installed:
4848
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
4949

5050
> [!WARNING]
51-
> The end of life date for PHP 7.4 was November 28, 2022.
52-
> The end of life date for PHP 8.0 was November 26, 2023.
53-
> If you are still using PHP 7.4 or 8.0, you should upgrade immediately.
54-
> The end of life date for PHP 8.1 will be November 25, 2024.
51+
> - The end of life date for PHP 7.4 was November 28, 2022.
52+
> - The end of life date for PHP 8.0 was November 26, 2023.
53+
> - If you are still using PHP 7.4 or 8.0, you should upgrade immediately.
54+
> - The end of life date for PHP 8.1 will be December 31, 2025.
5555
5656
Additionally, make sure that the following extensions are enabled in your PHP:
5757

app/Config/DocTypes.php

100755100644
File mode changed.

app/Config/Exceptions.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,10 @@ class Exceptions extends BaseConfig
6060

6161
/**
6262
* --------------------------------------------------------------------------
63-
* LOG DEPRECATIONS INSTEAD OF THROWING?
63+
* WHETHER TO THROW AN EXCEPTION ON DEPRECATED ERRORS
6464
* --------------------------------------------------------------------------
65-
* By default, CodeIgniter converts deprecations into exceptions. Also,
66-
* starting in PHP 8.1 will cause a lot of deprecated usage warnings.
67-
* Use this option to temporarily cease the warnings and instead log those.
68-
* This option also works for user deprecations.
65+
* If set to `true`, DEPRECATED errors are only logged and no exceptions are
66+
* thrown. This option also works for user deprecations.
6967
*/
7068
public bool $logDeprecations = true;
7169

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']);

spark

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626

2727
// Refuse to run when called from php-cgi
28-
if (strpos(PHP_SAPI, 'cgi') === 0) {
28+
if (str_starts_with(PHP_SAPI, 'cgi')) {
2929
exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n");
3030
}
3131

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/CLI/CLI.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ public static function prompt(string $field, $options = null, $validation = null
258258
static::fwrite(STDOUT, $field . (trim($field) !== '' ? ' ' : '') . $extraOutput . ': ');
259259

260260
// Read the input from keyboard.
261-
$input = trim(static::$io->input()) ?: (string) $default;
261+
$input = trim(static::$io->input());
262+
$input = ($input === '') ? (string) $default : $input;
262263

263264
if ($validation !== []) {
264265
while (! static::validate('"' . trim($field) . '"', $input, $validation)) {
@@ -330,7 +331,9 @@ public static function promptByMultipleKeys(string $text, array $options): array
330331
CLI::write($text);
331332
CLI::printKeysAndValues($options);
332333
CLI::newLine();
333-
$input = static::prompt($extraOutput) ?: 0; // 0 is default
334+
335+
$input = static::prompt($extraOutput);
336+
$input = ($input === '') ? '0' : $input; // 0 is default
334337

335338
// validation
336339
while (true) {
@@ -343,13 +346,15 @@ public static function promptByMultipleKeys(string $text, array $options): array
343346
// find max from input
344347
$maxInput = max($inputToArray);
345348

346-
// return the prompt again if $input contain(s) non-numeric charachter, except a comma.
347-
// And if max from $options less than max from input
348-
// it is mean user tried to access null value in $options
349+
// return the prompt again if $input contain(s) non-numeric character, except a comma.
350+
// And if max from $options less than max from input,
351+
// it means user tried to access null value in $options
349352
if (! $pattern || $maxOptions < $maxInput) {
350353
static::error('Please select correctly.');
351354
CLI::newLine();
352-
$input = static::prompt($extraOutput) ?: 0;
355+
356+
$input = static::prompt($extraOutput);
357+
$input = ($input === '') ? '0' : $input;
353358
} else {
354359
break;
355360
}

system/CLI/GeneratorTrait.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,15 @@ trait GeneratorTrait
9696
*
9797
* @internal
9898
*
99-
* @var array
99+
* @var array<int|string, string|null>
100100
*/
101101
private $params = [];
102102

103103
/**
104104
* Execute the command.
105105
*
106+
* @param array<int|string, string|null> $params
107+
*
106108
* @deprecated use generateClass() instead
107109
*/
108110
protected function execute(array $params): void
@@ -112,6 +114,8 @@ protected function execute(array $params): void
112114

113115
/**
114116
* Generates a class file from an existing template.
117+
*
118+
* @param array<int|string, string|null> $params
115119
*/
116120
protected function generateClass(array $params): void
117121
{
@@ -134,7 +138,8 @@ protected function generateClass(array $params): void
134138
/**
135139
* Generate a view file from an existing template.
136140
*
137-
* @param string $view namespaced view name that is generated
141+
* @param string $view namespaced view name that is generated
142+
* @param array<int|string, string|null> $params
138143
*/
139144
protected function generateView(string $view, array $params): void
140145
{
@@ -331,6 +336,8 @@ private function normalizeInputClassName(): string
331336
/**
332337
* Gets the generator view as defined in the `Config\Generators::$views`,
333338
* with fallback to `$template` when the defined view does not exist.
339+
*
340+
* @param array<string, mixed> $data
334341
*/
335342
protected function renderTemplate(array $data = []): string
336343
{
@@ -352,7 +359,10 @@ protected function renderTemplate(array $data = []): string
352359
/**
353360
* Performs pseudo-variables contained within view file.
354361
*
355-
* @param string $class namespaced classname or namespaced view.
362+
* @param string $class namespaced classname or namespaced view.
363+
* @param list<string> $search
364+
* @param list<string> $replace
365+
* @param array<string, bool|string|null> $data
356366
*
357367
* @return string generated file content
358368
*/

system/CodeIgniter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class CodeIgniter
5656
/**
5757
* The current version of CodeIgniter Framework
5858
*/
59-
public const CI_VERSION = '4.5.1';
59+
public const CI_VERSION = '4.5.2';
6060

6161
/**
6262
* App startup time.

system/Commands/Encryption/GenerateKey.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ protected function generateRandomKey(string $prefix, int $length): string
124124

125125
/**
126126
* Sets the new encryption key in your .env file.
127+
*
128+
* @param array<int|string, string|null> $params
127129
*/
128130
protected function setNewEncryptionKey(string $key, array $params): bool
129131
{
@@ -139,6 +141,8 @@ protected function setNewEncryptionKey(string $key, array $params): bool
139141

140142
/**
141143
* Checks whether to overwrite existing encryption key.
144+
*
145+
* @param array<int|string, string|null> $params
142146
*/
143147
protected function confirmOverwrite(array $params): bool
144148
{

0 commit comments

Comments
 (0)