Skip to content

Commit e91e4fa

Browse files
committed
Release v4.3.2
1 parent b1e5c64 commit e91e4fa

32 files changed

+358
-239
lines changed

.github/workflows/close-pull-request.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@ name: Close Pull Request
22

33
on:
44
pull_request_target:
5-
types: [opened]
5+
types: [opened, reopened]
6+
7+
permissions:
8+
pull-requests: write
69

710
jobs:
811
main:
912
runs-on: ubuntu-latest
1013
steps:
1114
- name: Close PR with nice message
12-
uses: superbrothers/close-pull-request@v3
13-
with:
14-
comment: >
15+
run: gh pr close ${{ env.ISSUE }} -c "${{ env.COMMENT }}"
16+
working-directory: ${{ github.workspace }}
17+
env:
18+
COMMENT: >
1519
Thank you for your pull request. However, you have submitted your PR on a read-only
16-
split of `codeigniter4/CodeIgniter4`. This repository, unfortunately, does
20+
split of <code>codeigniter4/CodeIgniter4</code>. This repository, unfortunately, does
1721
not accept PRs. Please submit your PR at https://github.com/codeigniter4/CodeIgniter4
1822
repository.<br/><br/>Thank you.
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
ISSUE: ${{ github.event.pull_request.html_url }}

app/Config/App.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@ class App extends BaseConfig
1212
* Base Site URL
1313
* --------------------------------------------------------------------------
1414
*
15-
* URL to your CodeIgniter root. Typically this will be your base URL,
15+
* URL to your CodeIgniter root. Typically, this will be your base URL,
1616
* WITH a trailing slash:
1717
*
1818
* http://example.com/
19-
*
20-
* If this is not set then CodeIgniter will try guess the protocol, domain
21-
* and path to your installation. However, you should always configure this
22-
* explicitly and never rely on auto-guessing, especially in production
23-
* environments.
2419
*/
2520
public string $baseURL = 'http://localhost:8080/';
2621

app/Config/Mimes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class Mimes
5353
'lzh' => 'application/octet-stream',
5454
'exe' => [
5555
'application/octet-stream',
56+
'application/vnd.microsoft.portable-executable',
57+
'application/x-dosexec',
5658
'application/x-msdownload',
5759
],
5860
'class' => 'application/octet-stream',

app/Views/errors/html/error_exception.php

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
<?php $error_id = uniqid('error', true); ?>
1+
<?php
2+
use Config\Services;
3+
use CodeIgniter\CodeIgniter;
4+
5+
$errorId = uniqid('error', true);
6+
?>
27
<!doctype html>
38
<html>
49
<head>
@@ -77,16 +82,16 @@
7782
<?php if (isset($row['class'])) : ?>
7883
&nbsp;&nbsp;&mdash;&nbsp;&nbsp;<?= esc($row['class'] . $row['type'] . $row['function']) ?>
7984
<?php if (! empty($row['args'])) : ?>
80-
<?php $args_id = $error_id . 'args' . $index ?>
81-
( <a href="#" onclick="return toggle('<?= esc($args_id, 'attr') ?>');">arguments</a> )
82-
<div class="args" id="<?= esc($args_id, 'attr') ?>">
85+
<?php $argsId = $errorId . 'args' . $index ?>
86+
( <a href="#" onclick="return toggle('<?= esc($argsId, 'attr') ?>');">arguments</a> )
87+
<div class="args" id="<?= esc($argsId, 'attr') ?>">
8388
<table cellspacing="0">
8489

8590
<?php
8691
$params = null;
8792
// Reflection by name is not available for closure function
8893
if (substr($row['function'], -1) !== '}') {
89-
$mirror = isset($row['class']) ? new \ReflectionMethod($row['class'], $row['function']) : new \ReflectionFunction($row['function']);
94+
$mirror = isset($row['class']) ? new ReflectionMethod($row['class'], $row['function']) : new ReflectionFunction($row['function']);
9095
$params = $mirror->getParameters();
9196
}
9297

@@ -189,7 +194,7 @@
189194

190195
<!-- Request -->
191196
<div class="content" id="request">
192-
<?php $request = \Config\Services::request(); ?>
197+
<?php $request = Services::request(); ?>
193198

194199
<table>
195200
<tbody>
@@ -283,21 +288,11 @@
283288
</tr>
284289
</thead>
285290
<tbody>
286-
<?php foreach ($headers as $value) : ?>
287-
<?php
288-
if (empty($value)) {
289-
continue;
290-
}
291-
292-
if (! is_array($value)) {
293-
$value = [$value];
294-
} ?>
295-
<?php foreach ($value as $h) : ?>
296-
<tr>
297-
<td><?= esc($h->getName(), 'html') ?></td>
298-
<td><?= esc($h->getValueLine(), 'html') ?></td>
299-
</tr>
300-
<?php endforeach; ?>
291+
<?php foreach ($headers as $header) : ?>
292+
<tr>
293+
<td><?= esc($header->getName(), 'html') ?></td>
294+
<td><?= esc($header->getValueLine(), 'html') ?></td>
295+
</tr>
301296
<?php endforeach; ?>
302297
</tbody>
303298
</table>
@@ -307,7 +302,7 @@
307302

308303
<!-- Response -->
309304
<?php
310-
$response = \Config\Services::response();
305+
$response = Services::response();
311306
$response->setStatusCode(http_response_code());
312307
?>
313308
<div class="content" id="response">
@@ -332,7 +327,7 @@
332327
</tr>
333328
</thead>
334329
<tbody>
335-
<?php foreach ($headers as $name => $value) : ?>
330+
<?php foreach (array_keys($headers) as $name) : ?>
336331
<tr>
337332
<td><?= esc($name, 'html') ?></td>
338333
<td><?= esc($response->getHeaderLine($name), 'html') ?></td>
@@ -387,7 +382,7 @@
387382
<p>
388383
Displayed at <?= esc(date('H:i:sa')) ?> &mdash;
389384
PHP: <?= esc(PHP_VERSION) ?> &mdash;
390-
CodeIgniter: <?= esc(\CodeIgniter\CodeIgniter::CI_VERSION) ?>
385+
CodeIgniter: <?= esc(CodeIgniter::CI_VERSION) ?>
391386
</p>
392387

393388
</div>

composer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"psr/log": "^1.1"
1414
},
1515
"require-dev": {
16-
"kint-php/kint": "^5.0.1",
16+
"kint-php/kint": "^5.0.3",
1717
"codeigniter/coding-standard": "^1.5",
1818
"fakerphp/faker": "^1.9",
1919
"friendsofphp/php-cs-fixer": "3.13.0",
@@ -42,6 +42,11 @@
4242
"ext-fileinfo": "Improves mime type detection for files",
4343
"ext-readline": "Improves CLI::input() usability"
4444
},
45+
"config": {
46+
"optimize-autoloader": true,
47+
"preferred-install": "dist",
48+
"sort-packages": true
49+
},
4550
"autoload": {
4651
"psr-4": {
4752
"CodeIgniter\\": "system/"
@@ -51,9 +56,6 @@
5156
]
5257
},
5358
"scripts": {
54-
"post-update-cmd": [
55-
"CodeIgniter\\ComposerScripts::postUpdate"
56-
],
5759
"test": "phpunit"
5860
},
5961
"support": {

public/.htaccess

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Disable directory browsing
2-
Options All -Indexes
2+
Options -Indexes
33

44
# ----------------------------------------------------------------------
55
# Rewrite engine

system/Autoloader/Autoloader.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,12 @@ private function loadComposerNamespaces(ClassLoader $composer, array $composerPa
381381
);
382382
}
383383
// This method requires Composer 2.0.14 or later.
384-
$packageList = InstalledVersions::getAllRawData()[0]['versions'];
384+
$allData = InstalledVersions::getAllRawData();
385+
$packageList = [];
386+
387+
foreach ($allData as $list) {
388+
$packageList = array_merge($packageList, $list['versions']);
389+
}
385390

386391
// Check config for $composerPackages.
387392
$only = $composerPackages['only'] ?? [];

system/Cache/Handlers/FileHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public function isSupported(): bool
229229
* Does the heavy lifting of actually retrieving the file and
230230
* verifying it's age.
231231
*
232-
* @return mixed
232+
* @return array|bool|float|int|object|string|null
233233
*/
234234
protected function getItem(string $filename)
235235
{
@@ -366,8 +366,8 @@ protected function getDirFileInfo(string $sourceDir, bool $topLevelOnly = true,
366366
* Options are: name, server_path, size, date, readable, writable, executable, fileperms
367367
* Returns FALSE if the file cannot be found.
368368
*
369-
* @param string $file Path to file
370-
* @param mixed $returnedValues Array or comma separated string of information returned
369+
* @param string $file Path to file
370+
* @param array|string $returnedValues Array or comma separated string of information returned
371371
*
372372
* @return array|false
373373
*/

system/CodeIgniter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class CodeIgniter
4747
/**
4848
* The current version of CodeIgniter Framework
4949
*/
50-
public const CI_VERSION = '4.3.1';
50+
public const CI_VERSION = '4.3.2';
5151

5252
/**
5353
* App startup time.

system/Common.php

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
use CodeIgniter\Cache\CacheInterface;
13+
use CodeIgniter\Config\BaseConfig;
1314
use CodeIgniter\Config\Factories;
1415
use CodeIgniter\Cookie\Cookie;
1516
use CodeIgniter\Cookie\CookieStore;
@@ -31,6 +32,7 @@
3132
use CodeIgniter\Test\TestLogger;
3233
use Config\App;
3334
use Config\Database;
35+
use Config\DocTypes;
3436
use Config\Logger;
3537
use Config\Services;
3638
use Config\View;
@@ -47,8 +49,7 @@
4749
*/
4850
function app_timezone(): string
4951
{
50-
/** @var App $config */
51-
$config = config('App');
52+
$config = config(App::class);
5253

5354
return $config->appTimezone;
5455
}
@@ -90,7 +91,11 @@ function cache(?string $key = null)
9091
function clean_path(string $path): string
9192
{
9293
// Resolve relative paths
93-
$path = realpath($path) ?: $path;
94+
try {
95+
$path = realpath($path) ?: $path;
96+
} catch (ErrorException|ValueError $e) {
97+
$path = 'error file path: ' . urlencode($path);
98+
}
9499

95100
switch (true) {
96101
case strpos($path, APPPATH) === 0:
@@ -199,7 +204,12 @@ function command(string $command)
199204
/**
200205
* More simple way of getting config instances from Factories
201206
*
202-
* @return object|null
207+
* @template ConfigTemplate of BaseConfig
208+
*
209+
* @param class-string<ConfigTemplate>|string $name
210+
*
211+
* @return ConfigTemplate|null
212+
* @phpstan-return ($name is class-string<ConfigTemplate> ? ConfigTemplate : object|null)
203213
*/
204214
function config(string $name, bool $getShared = true)
205215
{
@@ -491,7 +501,7 @@ function force_https(int $duration = 31_536_000, ?RequestInterface $request = nu
491501
Services::session(null, true)->regenerate(); // @codeCoverageIgnore
492502
}
493503

494-
$baseURL = config('App')->baseURL;
504+
$baseURL = config(App::class)->baseURL;
495505

496506
if (strpos($baseURL, 'https://') === 0) {
497507
$authority = substr($baseURL, strlen('https://'));
@@ -807,11 +817,12 @@ function log_message(string $level, string $message, array $context = [])
807817
/**
808818
* More simple way of getting model instances from Factories
809819
*
810-
* @template T of Model
820+
* @template ModelTemplate of Model
811821
*
812-
* @param class-string<T> $name
822+
* @param class-string<ModelTemplate>|string $name
813823
*
814-
* @return T
824+
* @return ModelTemplate|null
825+
* @phpstan-return ($name is class-string<ModelTemplate> ? ModelTemplate : object|null)
815826
*/
816827
function model(string $name, bool $getShared = true, ?ConnectionInterface &$conn = null)
817828
{
@@ -859,7 +870,7 @@ function old(string $key, $default = null, $escape = 'html')
859870
*
860871
* If more control is needed, you must use $response->redirect explicitly.
861872
*
862-
* @param string $route
873+
* @param string|null $route Route name or Controller::method
863874
*/
864875
function redirect(?string $route = null): RedirectResponse
865876
{
@@ -881,7 +892,7 @@ function redirect(?string $route = null): RedirectResponse
881892
*/
882893
function _solidus(): string
883894
{
884-
if (config('DocTypes')->html5 ?? false) {
895+
if (config(DocTypes::class)->html5 ?? false) {
885896
return '';
886897
}
887898

@@ -941,18 +952,18 @@ function response(): ResponseInterface
941952

942953
if (! function_exists('route_to')) {
943954
/**
944-
* Given a controller/method string and any params,
955+
* Given a route name or controller/method string and any params,
945956
* will attempt to build the relative URL to the
946957
* matching route.
947958
*
948959
* NOTE: This requires the controller/method to
949960
* have a route defined in the routes Config file.
950961
*
951-
* @param string $method Named route or Controller::method
962+
* @param string $method Route name or Controller::method
952963
* @param int|string ...$params One or more parameters to be passed to the route.
953964
* The last parameter allows you to set the locale.
954965
*
955-
* @return false|string
966+
* @return false|string The route (URI path relative to baseURL) or false if not found.
956967
*/
957968
function route_to(string $method, ...$params)
958969
{
@@ -969,8 +980,6 @@ function route_to(string $method, ...$params)
969980
* session()->set('foo', 'bar');
970981
* $foo = session('bar');
971982
*
972-
* @param string $val
973-
*
974983
* @return array|bool|float|int|object|Session|string|null
975984
* @phpstan-return ($val is null ? Session : array|bool|float|int|object|string|null)
976985
*/
@@ -1060,7 +1069,7 @@ function single_service(string $name, ...$params)
10601069
*/
10611070
function slash_item(string $item): ?string
10621071
{
1063-
$config = config('App');
1072+
$config = config(App::class);
10641073

10651074
if (! property_exists($config, $item)) {
10661075
return null;
@@ -1162,10 +1171,8 @@ function timer(?string $name = null, ?callable $callable = null)
11621171
*/
11631172
function view(string $name, array $data = [], array $options = []): string
11641173
{
1165-
/** @var CodeIgniter\View\View $renderer */
11661174
$renderer = Services::renderer();
11671175

1168-
/** @var \CodeIgniter\Config\View $config */
11691176
$config = config(View::class);
11701177
$saveData = $config->saveData;
11711178

0 commit comments

Comments
 (0)