Skip to content

Commit

Permalink
Merge pull request #7118 from codeigniter4/develop
Browse files Browse the repository at this point in the history
4.3.1 Ready code
  • Loading branch information
kenjis authored Jan 14, 2023
2 parents f8e4ec5 + 68e138f commit cc14fdd
Show file tree
Hide file tree
Showing 59 changed files with 468 additions and 355 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## [v4.3.1](https://github.com/codeigniter4/CodeIgniter4/tree/v4.3.1) (2023-01-14)
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.3.0...v4.3.1)

### Fixed Bugs

* fix: Email config in the .env doesn't appear as expected by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7078
* fix: TypeError in Validation is_unique/is_not_unique by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7085
* fix: revert method name resetQuery() changed accidentally by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7083
* 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
* docs: add missing instruction for Config/Exceptions in PHP 8.2 by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7100
* fix: Call to undefined method Composer\InstalledVersions::getAllRawData() error by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7107

### Refactoring

* [Rector] Enable AddDefaultValueForUndefinedVariableRector by @samsonasik in https://github.com/codeigniter4/CodeIgniter4/pull/7088

## [v4.3.0](https://github.com/codeigniter4/CodeIgniter4/tree/v4.3.0) (2023-01-10)
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.2.12...v4.3.0)

Expand All @@ -12,7 +28,6 @@
* fix: exceptionHandler may return invalid HTTP status code by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6228
* feat: add Form helpers for Validation Errors by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6384
* fix: ValidationInterface by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6253
* [Reverted] Make Unique Index Name Unique by @sclubricants in https://github.com/codeigniter4/CodeIgniter4/pull/6516
* fix: types in database classes by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6527
* fix: ResponseInterface (1) by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6556
* Improve BaseConnection::getForeignKeyData() and Forge::addForeignKey() by @sclubricants in https://github.com/codeigniter4/CodeIgniter4/pull/6468
Expand Down
40 changes: 34 additions & 6 deletions admin/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

> Documentation guide based on the releases of `4.0.5` and `4.1.0` on January 31, 2021.
>
> Updated for `4.2.10` on November 5, 2022.
> Updated for `4.3.0` on January 10, 2023.
>
> -MGatner
> -MGatner, kenjis
## [Minor version only] Merge minor version branch into develop

If you release a new minor version.

* Create PR to merge `4.x` into `develop` and merge it
* Delete the merged `4.x` branch (This closes all PRs to the branch)
* Do the regular release process. Go to the next "Changelog" section

## Changelog

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

To auto-generate, start drafting a new Release and use the "Generate release notes" button.
### Generate Changelog

To auto-generate, navigate to the [Releases](https://github.com/codeigniter4/CodeIgniter4/releases) page,
click the "Draft a new release" button.

* Tag: "v4.x.x" (Create new tag)
* Target: develop

Click the "Generate release notes" button.

Check the resulting content. If there are items in the *Others* section which
should be included in the changelog, add a label to the PR and regenerate
the changelog.

Copy the resulting content into **CHANGELOG.md** and adjust the format to match the existing content.

## Preparation
Expand Down Expand Up @@ -73,9 +94,9 @@ cd release-test
composer test && composer info codeigniter4/framework
```
* Verify that the user guide actions succeeded:
* "Deploy Distributable Repos", framework repo
* "Deploy Production", UG repo
* "pages-build-deployment", UG repo
* "[Deploy Distributable Repos](https://github.com/codeigniter4/CodeIgniter4/actions/workflows/deploy-distributables.yml)", the main repo
* "[Deploy Production](https://github.com/codeigniter4/userguide/actions/workflows/deploy.yml)", UG repo
* "[pages-build-deployment](https://github.com/codeigniter4/userguide/actions/workflows/pages/pages-build-deployment)", UG repo
* Fast-forward `develop` branch to catch the merge commit from `master`
```console
git fetch origin
Expand All @@ -92,6 +113,13 @@ git merge origin/4.x
git merge origin/develop
git push origin HEAD
```
* [Minor version only] Create the next minor upgrade branch `4.x`:
```console
git fetch origin
git switch develop
git switch -c 4.x
git push origin HEAD
```
* Publish any Security Advisories that were resolved from private forks
* Announce the release on the forums and Slack channel (note: this forum is restricted to administrators):
* Make a new topic in the "News & Discussion" forums: https://forum.codeigniter.com/forum-2.html
Expand Down
4 changes: 3 additions & 1 deletion admin/next-changelog-minor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,6 @@ Deprecations
Bugs Fixed
**********

See the repo's `CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_ for a complete list of bugs fixed.
See the repo's
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_
for a complete list of bugs fixed.
7 changes: 3 additions & 4 deletions admin/next-changelog-patch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ Release Date: Unreleased
BREAKING
********

Enhancements
************

Message Changes
***************

Expand All @@ -27,4 +24,6 @@ Deprecations
Bugs Fixed
**********

See the repo's `CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_ for a complete list of bugs fixed.
See the repo's
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_
for a complete list of bugs fixed.
12 changes: 6 additions & 6 deletions app/Config/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

class Email extends BaseConfig
{
public string $fromEmail;
public string $fromName;
public string $recipients;
public string $fromEmail = '';
public string $fromName = '';
public string $recipients = '';

/**
* The "user agent"
Expand All @@ -28,17 +28,17 @@ class Email extends BaseConfig
/**
* SMTP Server Address
*/
public string $SMTPHost;
public string $SMTPHost = '';

/**
* SMTP Username
*/
public string $SMTPUser;
public string $SMTPUser = '';

/**
* SMTP Password
*/
public string $SMTPPass;
public string $SMTPPass = '';

/**
* SMTP Port
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"phpunit/phpcov": "^8.2",
"phpunit/phpunit": "^9.1",
"predis/predis": "^1.1 || ^2.0",
"rector/rector": "0.15.2",
"rector/rector": "0.15.5",
"vimeo/psalm": "^5.0"
},
"suggest": {
Expand Down
25 changes: 0 additions & 25 deletions phpstan-baseline.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ parameters:
count: 1
path: system/Cache/Handlers/MemcachedHandler.php

-
message: "#^Variable \\$data might not be defined\\.$#"
count: 1
path: system/Cache/Handlers/MemcachedHandler.php

-
message: "#^Property CodeIgniter\\\\Cache\\\\Handlers\\\\RedisHandler\\:\\:\\$redis \\(Redis\\) in isset\\(\\) is not nullable\\.$#"
count: 1
Expand Down Expand Up @@ -200,11 +195,6 @@ parameters:
count: 1
path: system/Helpers/number_helper.php

-
message: "#^Variable \\$count might not be defined\\.$#"
count: 1
path: system/Helpers/url_helper.php

-
message: "#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$image \\(CodeIgniter\\\\Images\\\\Image\\) in empty\\(\\) is not falsy\\.$#"
count: 1
Expand All @@ -230,21 +220,6 @@ parameters:
count: 4
path: system/Images/Handlers/ImageMagickHandler.php

-
message: "#^Variable \\$gravity might not be defined\\.$#"
count: 1
path: system/Images/Handlers/ImageMagickHandler.php

-
message: "#^Variable \\$xAxis might not be defined\\.$#"
count: 1
path: system/Images/Handlers/ImageMagickHandler.php

-
message: "#^Variable \\$yAxis might not be defined\\.$#"
count: 1
path: system/Images/Handlers/ImageMagickHandler.php

-
message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getDefaultNamespace\\(\\)\\.$#"
count: 3
Expand Down
4 changes: 0 additions & 4 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector;
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
Expand Down Expand Up @@ -106,9 +105,6 @@
// sometime too detail
CountOnNullRector::class,

// may not be unitialized on purpose
AddDefaultValueForUndefinedVariableRector::class,

// use mt_rand instead of random_int on purpose on non-cryptographically random
RandomFunctionRector::class,

Expand Down
8 changes: 8 additions & 0 deletions system/Autoloader/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,14 @@ private function loadComposerNamespaces(ClassLoader $composer, array $composerPa
unset($namespacePaths['CodeIgniter\\']);
}

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

// Check config for $composerPackages.
Expand Down
3 changes: 2 additions & 1 deletion system/Cache/Handlers/MemcachedHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public function initialize()
*/
public function get(string $key)
{
$key = static::validateKey($key, $this->prefix);
$data = [];
$key = static::validateKey($key, $this->prefix);

if ($this->memcached instanceof Memcached) {
$data = $this->memcached->get($key);
Expand Down
2 changes: 1 addition & 1 deletion system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class CodeIgniter
/**
* The current version of CodeIgniter Framework
*/
public const CI_VERSION = '4.3.0';
public const CI_VERSION = '4.3.1';

/**
* App startup time.
Expand Down
1 change: 1 addition & 0 deletions system/Commands/Generators/MigrationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public function run(array $params)
*/
protected function prepare(string $class): string
{
$data = [];
$data['session'] = false;

if ($this->getOption('session')) {
Expand Down
1 change: 1 addition & 0 deletions system/Commands/Generators/SessionMigrationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public function run(array $params)
*/
protected function prepare(string $class): string
{
$data = [];
$data['session'] = true;
$data['table'] = $this->getOption('t');
$data['DBGroup'] = $this->getOption('g');
Expand Down
1 change: 1 addition & 0 deletions system/Commands/Utilities/FilterCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class FilterCheck extends BaseCommand
*/
public function run(array $params)
{
$tbody = [];
if (! isset($params[0], $params[1])) {
CLI::error('You must specify a HTTP verb and a route.');
CLI::write(' Usage: ' . $this->usage);
Expand Down
5 changes: 3 additions & 2 deletions system/Database/BaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,7 @@ public function orHaving($key, $value = null, ?bool $escape = null)
*/
public function orderBy(string $orderBy, string $direction = '', ?bool $escape = null)
{
$qbOrderBy = [];
if (empty($orderBy)) {
return $this;
}
Expand Down Expand Up @@ -3274,7 +3275,7 @@ protected function isLiteral(string $str): bool
*
* @return $this
*/
public function resetQueryAsData()
public function resetQuery()
{
$this->resetSelect();
$this->resetWrite();
Expand Down Expand Up @@ -3456,7 +3457,7 @@ protected function setBind(string $key, $value = null, bool $escape = true): str
*/
protected function cleanClone()
{
return (clone $this)->from([], true)->resetQueryAsData();
return (clone $this)->from([], true)->resetQuery();
}

/**
Expand Down
1 change: 1 addition & 0 deletions system/Database/SQLSRV/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ public function getPlatform(): string
*/
public function getVersion(): string
{
$info = [];
if (isset($this->dataCache['version'])) {
return $this->dataCache['version'];
}
Expand Down
2 changes: 2 additions & 0 deletions system/Debug/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public function __construct(ExceptionsConfig $config, $request, ResponseInterfac
$this->response = $response;

// workaround for upgraded users
// This causes "Deprecated: Creation of dynamic property" in PHP 8.2.
// @TODO remove this after dropping PHP 8.1 support.
if (! isset($this->config->sensitiveDataInTrace)) {
$this->config->sensitiveDataInTrace = [];
}
Expand Down
1 change: 1 addition & 0 deletions system/Debug/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function __construct(ToolbarConfig $config)
*/
public function run(float $startTime, float $totalTime, RequestInterface $request, ResponseInterface $response): string
{
$data = [];
// Data items used within the view.
$data['url'] = current_url();
$data['method'] = strtoupper($request->getMethod());
Expand Down
1 change: 1 addition & 0 deletions system/Debug/Toolbar/Collectors/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ protected function formatTimelineData(): array
*/
public function display(): array
{
$data = [];
$data['queries'] = array_map(static function (array $query) {
$isDuplicate = $query['duplicate'] === true;

Expand Down
6 changes: 5 additions & 1 deletion system/Email/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,11 @@ public function send($autoClear = true)
$this->setReplyTo($this->headers['From']);
}

if (empty($this->recipients) && ! isset($this->headers['To']) && empty($this->BCCArray) && ! isset($this->headers['Bcc']) && ! isset($this->headers['Cc'])) {
if (
empty($this->recipients) && ! isset($this->headers['To'])
&& empty($this->BCCArray) && ! isset($this->headers['Bcc'])
&& ! isset($this->headers['Cc'])
) {
$this->setErrorMessage(lang('Email.noRecipients'));

return false;
Expand Down
1 change: 1 addition & 0 deletions system/Helpers/html_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ function link_tag(
bool $indexPage = false,
string $hreflang = ''
): string {
$attributes = [];
// extract fields if needed
if (is_array($href)) {
$rel = $href['rel'] ?? $rel;
Expand Down
11 changes: 5 additions & 6 deletions system/Helpers/url_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ function _get_uri(string $relativePath = '', ?App $config = null): URI
// Build the full URL based on $config and $relativePath
$request = Services::request();

if ($request instanceof CLIRequest) {
/** @var App $config */
$url = rtrim($config->baseURL, '/ ') . '/';
} else {
$url = $request->getUri()->getBaseURL();
}
/** @var App $config */
$url = $request instanceof CLIRequest
? rtrim($config->baseURL, '/ ') . '/'
: $request->getUri()->getBaseURL();

// Check for an index page
if ($config->indexPage !== '') {
Expand Down Expand Up @@ -329,6 +327,7 @@ function mailto(string $email, string $title = '', $attributes = ''): string
*/
function safe_mailto(string $email, string $title = '', $attributes = ''): string
{
$count = 0;
if (trim($title) === '') {
$title = $email;
}
Expand Down
Loading

0 comments on commit cc14fdd

Please sign in to comment.