Skip to content

Commit cc14fdd

Browse files
authored
Merge pull request #7118 from codeigniter4/develop
4.3.1 Ready code
2 parents f8e4ec5 + 68e138f commit cc14fdd

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

+468
-355
lines changed

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## [v4.3.1](https://github.com/codeigniter4/CodeIgniter4/tree/v4.3.1) (2023-01-14)
4+
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.3.0...v4.3.1)
5+
6+
### Fixed Bugs
7+
8+
* fix: Email config in the .env doesn't appear as expected by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7078
9+
* fix: TypeError in Validation is_unique/is_not_unique by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7085
10+
* fix: revert method name resetQuery() changed accidentally by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7083
11+
* fix: handling float in Validation Strcit Rules (greater_than, greater_than_equal_to, less_than, less_than_equal_to) by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7098
12+
* docs: add missing instruction for Config/Exceptions in PHP 8.2 by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7100
13+
* fix: Call to undefined method Composer\InstalledVersions::getAllRawData() error by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7107
14+
15+
### Refactoring
16+
17+
* [Rector] Enable AddDefaultValueForUndefinedVariableRector by @samsonasik in https://github.com/codeigniter4/CodeIgniter4/pull/7088
18+
319
## [v4.3.0](https://github.com/codeigniter4/CodeIgniter4/tree/v4.3.0) (2023-01-10)
420
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.2.12...v4.3.0)
521

@@ -12,7 +28,6 @@
1228
* fix: exceptionHandler may return invalid HTTP status code by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6228
1329
* feat: add Form helpers for Validation Errors by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6384
1430
* fix: ValidationInterface by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6253
15-
* [Reverted] Make Unique Index Name Unique by @sclubricants in https://github.com/codeigniter4/CodeIgniter4/pull/6516
1631
* fix: types in database classes by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6527
1732
* fix: ResponseInterface (1) by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6556
1833
* Improve BaseConnection::getForeignKeyData() and Forge::addForeignKey() by @sclubricants in https://github.com/codeigniter4/CodeIgniter4/pull/6468

admin/RELEASE.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@
22

33
> Documentation guide based on the releases of `4.0.5` and `4.1.0` on January 31, 2021.
44
>
5-
> Updated for `4.2.10` on November 5, 2022.
5+
> Updated for `4.3.0` on January 10, 2023.
66
>
7-
> -MGatner
7+
> -MGatner, kenjis
8+
9+
## [Minor version only] Merge minor version branch into develop
10+
11+
If you release a new minor version.
12+
13+
* Create PR to merge `4.x` into `develop` and merge it
14+
* Delete the merged `4.x` branch (This closes all PRs to the branch)
15+
* Do the regular release process. Go to the next "Changelog" section
816

917
## Changelog
1018

@@ -17,7 +25,20 @@ When generating the changelog each Pull Request to be included must have one of
1725
PRs with breaking changes must have the following additional label:
1826
- **breaking change** ... PRs that may break existing functionalities
1927

20-
To auto-generate, start drafting a new Release and use the "Generate release notes" button.
28+
### Generate Changelog
29+
30+
To auto-generate, navigate to the [Releases](https://github.com/codeigniter4/CodeIgniter4/releases) page,
31+
click the "Draft a new release" button.
32+
33+
* Tag: "v4.x.x" (Create new tag)
34+
* Target: develop
35+
36+
Click the "Generate release notes" button.
37+
38+
Check the resulting content. If there are items in the *Others* section which
39+
should be included in the changelog, add a label to the PR and regenerate
40+
the changelog.
41+
2142
Copy the resulting content into **CHANGELOG.md** and adjust the format to match the existing content.
2243

2344
## Preparation
@@ -73,9 +94,9 @@ cd release-test
7394
composer test && composer info codeigniter4/framework
7495
```
7596
* Verify that the user guide actions succeeded:
76-
* "Deploy Distributable Repos", framework repo
77-
* "Deploy Production", UG repo
78-
* "pages-build-deployment", UG repo
97+
* "[Deploy Distributable Repos](https://github.com/codeigniter4/CodeIgniter4/actions/workflows/deploy-distributables.yml)", the main repo
98+
* "[Deploy Production](https://github.com/codeigniter4/userguide/actions/workflows/deploy.yml)", UG repo
99+
* "[pages-build-deployment](https://github.com/codeigniter4/userguide/actions/workflows/pages/pages-build-deployment)", UG repo
79100
* Fast-forward `develop` branch to catch the merge commit from `master`
80101
```console
81102
git fetch origin
@@ -92,6 +113,13 @@ git merge origin/4.x
92113
git merge origin/develop
93114
git push origin HEAD
94115
```
116+
* [Minor version only] Create the next minor upgrade branch `4.x`:
117+
```console
118+
git fetch origin
119+
git switch develop
120+
git switch -c 4.x
121+
git push origin HEAD
122+
```
95123
* Publish any Security Advisories that were resolved from private forks
96124
* Announce the release on the forums and Slack channel (note: this forum is restricted to administrators):
97125
* Make a new topic in the "News & Discussion" forums: https://forum.codeigniter.com/forum-2.html

admin/next-changelog-minor.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,6 @@ Deprecations
7171
Bugs Fixed
7272
**********
7373

74-
See the repo's `CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_ for a complete list of bugs fixed.
74+
See the repo's
75+
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_
76+
for a complete list of bugs fixed.

admin/next-changelog-patch.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ Release Date: Unreleased
1212
BREAKING
1313
********
1414

15-
Enhancements
16-
************
17-
1815
Message Changes
1916
***************
2017

@@ -27,4 +24,6 @@ Deprecations
2724
Bugs Fixed
2825
**********
2926

30-
See the repo's `CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_ for a complete list of bugs fixed.
27+
See the repo's
28+
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_
29+
for a complete list of bugs fixed.

app/Config/Email.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
class Email extends BaseConfig
88
{
9-
public string $fromEmail;
10-
public string $fromName;
11-
public string $recipients;
9+
public string $fromEmail = '';
10+
public string $fromName = '';
11+
public string $recipients = '';
1212

1313
/**
1414
* The "user agent"
@@ -28,17 +28,17 @@ class Email extends BaseConfig
2828
/**
2929
* SMTP Server Address
3030
*/
31-
public string $SMTPHost;
31+
public string $SMTPHost = '';
3232

3333
/**
3434
* SMTP Username
3535
*/
36-
public string $SMTPUser;
36+
public string $SMTPUser = '';
3737

3838
/**
3939
* SMTP Password
4040
*/
41-
public string $SMTPPass;
41+
public string $SMTPPass = '';
4242

4343
/**
4444
* SMTP Port

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"phpunit/phpcov": "^8.2",
2626
"phpunit/phpunit": "^9.1",
2727
"predis/predis": "^1.1 || ^2.0",
28-
"rector/rector": "0.15.2",
28+
"rector/rector": "0.15.5",
2929
"vimeo/psalm": "^5.0"
3030
},
3131
"suggest": {

phpstan-baseline.neon.dist

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ parameters:
2525
count: 1
2626
path: system/Cache/Handlers/MemcachedHandler.php
2727

28-
-
29-
message: "#^Variable \\$data might not be defined\\.$#"
30-
count: 1
31-
path: system/Cache/Handlers/MemcachedHandler.php
32-
3328
-
3429
message: "#^Property CodeIgniter\\\\Cache\\\\Handlers\\\\RedisHandler\\:\\:\\$redis \\(Redis\\) in isset\\(\\) is not nullable\\.$#"
3530
count: 1
@@ -200,11 +195,6 @@ parameters:
200195
count: 1
201196
path: system/Helpers/number_helper.php
202197

203-
-
204-
message: "#^Variable \\$count might not be defined\\.$#"
205-
count: 1
206-
path: system/Helpers/url_helper.php
207-
208198
-
209199
message: "#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$image \\(CodeIgniter\\\\Images\\\\Image\\) in empty\\(\\) is not falsy\\.$#"
210200
count: 1
@@ -230,21 +220,6 @@ parameters:
230220
count: 4
231221
path: system/Images/Handlers/ImageMagickHandler.php
232222

233-
-
234-
message: "#^Variable \\$gravity might not be defined\\.$#"
235-
count: 1
236-
path: system/Images/Handlers/ImageMagickHandler.php
237-
238-
-
239-
message: "#^Variable \\$xAxis might not be defined\\.$#"
240-
count: 1
241-
path: system/Images/Handlers/ImageMagickHandler.php
242-
243-
-
244-
message: "#^Variable \\$yAxis might not be defined\\.$#"
245-
count: 1
246-
path: system/Images/Handlers/ImageMagickHandler.php
247-
248223
-
249224
message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getDefaultNamespace\\(\\)\\.$#"
250225
count: 3

rector.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
3737
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
3838
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
39-
use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector;
4039
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
4140
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
4241
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
@@ -106,9 +105,6 @@
106105
// sometime too detail
107106
CountOnNullRector::class,
108107

109-
// may not be unitialized on purpose
110-
AddDefaultValueForUndefinedVariableRector::class,
111-
112108
// use mt_rand instead of random_int on purpose on non-cryptographically random
113109
RandomFunctionRector::class,
114110

system/Autoloader/Autoloader.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,14 @@ private function loadComposerNamespaces(ClassLoader $composer, array $composerPa
373373
unset($namespacePaths['CodeIgniter\\']);
374374
}
375375

376+
if (! method_exists(InstalledVersions::class, 'getAllRawData')) {
377+
throw new RuntimeException(
378+
'Your Composer version is too old.'
379+
. ' Please update Composer (run `composer self-update`) to v2.0.14 or later'
380+
. ' and remove your vendor/ directory, and run `composer update`.'
381+
);
382+
}
383+
// This method requires Composer 2.0.14 or later.
376384
$packageList = InstalledVersions::getAllRawData()[0]['versions'];
377385

378386
// Check config for $composerPackages.

system/Cache/Handlers/MemcachedHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ public function initialize()
124124
*/
125125
public function get(string $key)
126126
{
127-
$key = static::validateKey($key, $this->prefix);
127+
$data = [];
128+
$key = static::validateKey($key, $this->prefix);
128129

129130
if ($this->memcached instanceof Memcached) {
130131
$data = $this->memcached->get($key);

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.0';
50+
public const CI_VERSION = '4.3.1';
5151

5252
/**
5353
* App startup time.

system/Commands/Generators/MigrationGenerator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public function run(array $params)
9797
*/
9898
protected function prepare(string $class): string
9999
{
100+
$data = [];
100101
$data['session'] = false;
101102

102103
if ($this->getOption('session')) {

system/Commands/Generators/SessionMigrationGenerator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public function run(array $params)
8989
*/
9090
protected function prepare(string $class): string
9191
{
92+
$data = [];
9293
$data['session'] = true;
9394
$data['table'] = $this->getOption('t');
9495
$data['DBGroup'] = $this->getOption('g');

system/Commands/Utilities/FilterCheck.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class FilterCheck extends BaseCommand
7272
*/
7373
public function run(array $params)
7474
{
75+
$tbody = [];
7576
if (! isset($params[0], $params[1])) {
7677
CLI::error('You must specify a HTTP verb and a route.');
7778
CLI::write(' Usage: ' . $this->usage);

system/Database/BaseBuilder.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,7 @@ public function orHaving($key, $value = null, ?bool $escape = null)
14231423
*/
14241424
public function orderBy(string $orderBy, string $direction = '', ?bool $escape = null)
14251425
{
1426+
$qbOrderBy = [];
14261427
if (empty($orderBy)) {
14271428
return $this;
14281429
}
@@ -3274,7 +3275,7 @@ protected function isLiteral(string $str): bool
32743275
*
32753276
* @return $this
32763277
*/
3277-
public function resetQueryAsData()
3278+
public function resetQuery()
32783279
{
32793280
$this->resetSelect();
32803281
$this->resetWrite();
@@ -3456,7 +3457,7 @@ protected function setBind(string $key, $value = null, bool $escape = true): str
34563457
*/
34573458
protected function cleanClone()
34583459
{
3459-
return (clone $this)->from([], true)->resetQueryAsData();
3460+
return (clone $this)->from([], true)->resetQuery();
34603461
}
34613462

34623463
/**

system/Database/SQLSRV/Connection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ public function getPlatform(): string
529529
*/
530530
public function getVersion(): string
531531
{
532+
$info = [];
532533
if (isset($this->dataCache['version'])) {
533534
return $this->dataCache['version'];
534535
}

system/Debug/Exceptions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public function __construct(ExceptionsConfig $config, $request, ResponseInterfac
8080
$this->response = $response;
8181

8282
// workaround for upgraded users
83+
// This causes "Deprecated: Creation of dynamic property" in PHP 8.2.
84+
// @TODO remove this after dropping PHP 8.1 support.
8385
if (! isset($this->config->sensitiveDataInTrace)) {
8486
$this->config->sensitiveDataInTrace = [];
8587
}

system/Debug/Toolbar.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public function __construct(ToolbarConfig $config)
7676
*/
7777
public function run(float $startTime, float $totalTime, RequestInterface $request, ResponseInterface $response): string
7878
{
79+
$data = [];
7980
// Data items used within the view.
8081
$data['url'] = current_url();
8182
$data['method'] = strtoupper($request->getMethod());

system/Debug/Toolbar/Collectors/Database.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ protected function formatTimelineData(): array
140140
*/
141141
public function display(): array
142142
{
143+
$data = [];
143144
$data['queries'] = array_map(static function (array $query) {
144145
$isDuplicate = $query['duplicate'] === true;
145146

system/Email/Email.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,11 @@ public function send($autoClear = true)
15391539
$this->setReplyTo($this->headers['From']);
15401540
}
15411541

1542-
if (empty($this->recipients) && ! isset($this->headers['To']) && empty($this->BCCArray) && ! isset($this->headers['Bcc']) && ! isset($this->headers['Cc'])) {
1542+
if (
1543+
empty($this->recipients) && ! isset($this->headers['To'])
1544+
&& empty($this->BCCArray) && ! isset($this->headers['Bcc'])
1545+
&& ! isset($this->headers['Cc'])
1546+
) {
15431547
$this->setErrorMessage(lang('Email.noRecipients'));
15441548

15451549
return false;

system/Helpers/html_helper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ function link_tag(
236236
bool $indexPage = false,
237237
string $hreflang = ''
238238
): string {
239+
$attributes = [];
239240
// extract fields if needed
240241
if (is_array($href)) {
241242
$rel = $href['rel'] ?? $rel;

system/Helpers/url_helper.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ function _get_uri(string $relativePath = '', ?App $config = null): URI
5656
// Build the full URL based on $config and $relativePath
5757
$request = Services::request();
5858

59-
if ($request instanceof CLIRequest) {
60-
/** @var App $config */
61-
$url = rtrim($config->baseURL, '/ ') . '/';
62-
} else {
63-
$url = $request->getUri()->getBaseURL();
64-
}
59+
/** @var App $config */
60+
$url = $request instanceof CLIRequest
61+
? rtrim($config->baseURL, '/ ') . '/'
62+
: $request->getUri()->getBaseURL();
6563

6664
// Check for an index page
6765
if ($config->indexPage !== '') {
@@ -329,6 +327,7 @@ function mailto(string $email, string $title = '', $attributes = ''): string
329327
*/
330328
function safe_mailto(string $email, string $title = '', $attributes = ''): string
331329
{
330+
$count = 0;
332331
if (trim($title) === '') {
333332
$title = $email;
334333
}

0 commit comments

Comments
 (0)