From 627235c2b721ca6a66c0296e737b54ce28c5d319 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sun, 27 Jul 2025 01:12:10 +0800 Subject: [PATCH 01/12] docs: add changelog and upgrade for v4.6.3 (#9643) --- user_guide_src/source/changelogs/index.rst | 1 + user_guide_src/source/changelogs/v4.6.3.rst | 35 ++++++++++++ .../source/installation/upgrade_463.rst | 55 +++++++++++++++++++ .../source/installation/upgrading.rst | 1 + 4 files changed, 92 insertions(+) create mode 100644 user_guide_src/source/changelogs/v4.6.3.rst create mode 100644 user_guide_src/source/installation/upgrade_463.rst diff --git a/user_guide_src/source/changelogs/index.rst b/user_guide_src/source/changelogs/index.rst index bd881c8b59fe..248594e298c0 100644 --- a/user_guide_src/source/changelogs/index.rst +++ b/user_guide_src/source/changelogs/index.rst @@ -12,6 +12,7 @@ See all the changes. .. toctree:: :titlesonly: + v4.6.3 v4.6.2 v4.6.1 v4.6.0 diff --git a/user_guide_src/source/changelogs/v4.6.3.rst b/user_guide_src/source/changelogs/v4.6.3.rst new file mode 100644 index 000000000000..6b44883af986 --- /dev/null +++ b/user_guide_src/source/changelogs/v4.6.3.rst @@ -0,0 +1,35 @@ +############# +Version 4.6.3 +############# + +Release Date: Unreleased + +**4.6.3 release of CodeIgniter4** + +.. contents:: + :local: + :depth: 3 + +******** +BREAKING +******** + +*************** +Message Changes +*************** + +******* +Changes +******* + +************ +Deprecations +************ + +********** +Bugs Fixed +********** + +See the repo's +`CHANGELOG.md `_ +for a complete list of bugs fixed. diff --git a/user_guide_src/source/installation/upgrade_463.rst b/user_guide_src/source/installation/upgrade_463.rst new file mode 100644 index 000000000000..9d94c298600a --- /dev/null +++ b/user_guide_src/source/installation/upgrade_463.rst @@ -0,0 +1,55 @@ +############################# +Upgrading from 4.6.2 to 4.6.3 +############################# + +Please refer to the upgrade instructions corresponding to your installation method. + +- :ref:`Composer Installation App Starter Upgrading ` +- :ref:`Composer Installation Adding CodeIgniter4 to an Existing Project Upgrading ` +- :ref:`Manual Installation Upgrading ` + +.. contents:: + :local: + :depth: 2 + +********************** +Mandatory File Changes +********************** + +**************** +Breaking Changes +**************** + +********************* +Breaking Enhancements +********************* + +************* +Project Files +************* + +Some files in the **project space** (root, app, public, writable) received updates. Due to +these files being outside of the **system** scope they will not be changed without your intervention. + +.. note:: There are some third-party CodeIgniter modules available to assist + with merging changes to the project space: + `Explore on Packagist `_. + +Content Changes +=============== + +The following files received significant changes (including deprecations or visual adjustments) +and it is recommended that you merge the updated versions with your application: + +Config +------ + +- @TODO + +All Changes +=========== + +This is a list of all files in the **project space** that received changes; +many will be simple comments or formatting that have no effect on the runtime: + +- @TODO diff --git a/user_guide_src/source/installation/upgrading.rst b/user_guide_src/source/installation/upgrading.rst index 0b9f2dd806d0..c03b6d0b8c7f 100644 --- a/user_guide_src/source/installation/upgrading.rst +++ b/user_guide_src/source/installation/upgrading.rst @@ -16,6 +16,7 @@ See also :doc:`./backward_compatibility_notes`. backward_compatibility_notes + upgrade_463 upgrade_462 upgrade_461 upgrade_460 From 6c54aa9b52748aab7ae7d3647b6cb6699787f834 Mon Sep 17 00:00:00 2001 From: michalsn Date: Mon, 28 Jul 2025 08:41:27 +0200 Subject: [PATCH 02/12] fix: CID check in Email class --- system/Email/Email.php | 2 +- user_guide_src/source/changelogs/v4.6.3.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/system/Email/Email.php b/system/Email/Email.php index 3e4cd5671a97..6db52f3fa656 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -1308,7 +1308,7 @@ protected function appendAttachments(&$body, $boundary, $multipart = null) . 'Content-Type: ' . $attachment['type'] . '; name="' . $name . '"' . $this->newline . 'Content-Disposition: ' . $attachment['disposition'] . ';' . $this->newline . 'Content-Transfer-Encoding: base64' . $this->newline - . ($attachment['cid'] === '' ? '' : 'Content-ID: <' . $attachment['cid'] . '>' . $this->newline) + . (isset($attachment['cid']) && $attachment['cid'] !== '' ? 'Content-ID: <' . $attachment['cid'] . '>' . $this->newline : '') . $this->newline . $attachment['content'] . $this->newline; } diff --git a/user_guide_src/source/changelogs/v4.6.3.rst b/user_guide_src/source/changelogs/v4.6.3.rst index 6b44883af986..fa7786891956 100644 --- a/user_guide_src/source/changelogs/v4.6.3.rst +++ b/user_guide_src/source/changelogs/v4.6.3.rst @@ -30,6 +30,8 @@ Deprecations Bugs Fixed ********** +- **Email:** Fixed a bug with CID check when building email attachments. + See the repo's `CHANGELOG.md `_ for a complete list of bugs fixed. From c02184d3e80736fffeafd4d1cafe39f4974e6fbd Mon Sep 17 00:00:00 2001 From: michalsn Date: Mon, 28 Jul 2025 09:13:29 +0200 Subject: [PATCH 03/12] add a test for missing CID --- tests/system/Email/EmailTest.php | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/system/Email/EmailTest.php b/tests/system/Email/EmailTest.php index 8d865b58ddeb..ca42613505e4 100644 --- a/tests/system/Email/EmailTest.php +++ b/tests/system/Email/EmailTest.php @@ -21,6 +21,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; use ReflectionException; +use ReflectionMethod; /** * @internal @@ -220,6 +221,41 @@ public function testSetAttachmentCIDBufferString(): void ); } + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/9644 + * + * @throws ReflectionException + */ + public function testAppendAttachmentsWithoutCID(): void + { + $email = $this->createMockEmail(); + + // Manually inject an attachment without 'cid' + $this->setPrivateProperty($email, 'attachments', [ + [ + 'multipart' => 'mixed', + 'content' => 'VGhpcyBpcyBhIHRlc3QgZmlsZSBjb250ZW50Lg==', // base64 for "This is a test file content." + 'filename' => '', + 'type' => 'application/pdf', + 'name' => ['testfile.pdf'], + 'disposition' => 'attachment', + ], + ]); + + $body = ''; + $boundary = 'test-boundary'; + + // Use ReflectionMethod to call protected method with pass-by-reference + $refMethod = new ReflectionMethod($email, 'appendAttachments'); + $refMethod->invokeArgs($email, [&$body, $boundary, 'mixed']); + + // Assertion: Should not include a Content-ID header + $this->assertStringContainsString('Content-Type: application/pdf; name="testfile.pdf"', $body); + $this->assertStringContainsString('Content-Disposition: attachment;', $body); + $this->assertStringNotContainsString('Content-ID:', $body); + $this->assertStringContainsString('--' . $boundary . '--', $body); + } + /** * @throws ReflectionException */ From 9099f8602be8141d2eac7ebe19505d2af3815cab Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 29 Jul 2025 11:54:21 +0200 Subject: [PATCH 04/12] fix: use is_resource() instead of null check for SMTP connection validation --- system/Email/Email.php | 2 +- user_guide_src/source/changelogs/v4.6.3.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/system/Email/Email.php b/system/Email/Email.php index 6db52f3fa656..7db123a1d4de 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -2227,7 +2227,7 @@ protected function mimeTypes($ext = '') public function __destruct() { - if ($this->SMTPConnect !== null) { + if (is_resource($this->SMTPConnect)) { try { $this->sendCommand('quit'); } catch (ErrorException $e) { diff --git a/user_guide_src/source/changelogs/v4.6.3.rst b/user_guide_src/source/changelogs/v4.6.3.rst index fa7786891956..c4d79f349f70 100644 --- a/user_guide_src/source/changelogs/v4.6.3.rst +++ b/user_guide_src/source/changelogs/v4.6.3.rst @@ -31,6 +31,7 @@ Bugs Fixed ********** - **Email:** Fixed a bug with CID check when building email attachments. +- **Email:** Fixed SMTP connection resource validation in the class destructor. See the repo's `CHANGELOG.md `_ From cc7f32fe8b2b7ef30b082035c201fac2a5e2314f Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 29 Jul 2025 12:02:57 +0200 Subject: [PATCH 05/12] update changelog --- user_guide_src/source/changelogs/v4.6.3.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelogs/v4.6.3.rst b/user_guide_src/source/changelogs/v4.6.3.rst index c4d79f349f70..ae525e52c3f8 100644 --- a/user_guide_src/source/changelogs/v4.6.3.rst +++ b/user_guide_src/source/changelogs/v4.6.3.rst @@ -31,7 +31,7 @@ Bugs Fixed ********** - **Email:** Fixed a bug with CID check when building email attachments. -- **Email:** Fixed SMTP connection resource validation in the class destructor. +- **Email:** Fixed a bug with SMTP connection resource validation in the class destructor. See the repo's `CHANGELOG.md `_ From a577705a4adf90fac55f680b16309e6503f8838c Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 29 Jul 2025 20:02:46 +0200 Subject: [PATCH 06/12] add the isSMTPConnected() method for a type-safe check --- system/Email/Email.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/system/Email/Email.php b/system/Email/Email.php index 7db123a1d4de..a11dd2a950cf 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -1886,7 +1886,7 @@ protected function SMTPEnd() */ protected function SMTPConnect() { - if (is_resource($this->SMTPConnect)) { + if ($this->isSMTPConnected()) { return true; } @@ -1910,7 +1910,7 @@ protected function SMTPConnect() $this->SMTPTimeout, ); - if (! is_resource($this->SMTPConnect)) { + if (! $this->isSMTPConnected()) { $this->setErrorMessage(lang('Email.SMTPError', [$errno . ' ' . $errstr])); return false; @@ -2227,7 +2227,7 @@ protected function mimeTypes($ext = '') public function __destruct() { - if (is_resource($this->SMTPConnect)) { + if ($this->isSMTPConnected()) { try { $this->sendCommand('quit'); } catch (ErrorException $e) { @@ -2284,4 +2284,14 @@ protected function setArchiveValues(): array return $this->archive; } + + /** + * Checks if there is an active SMTP connection. + * + * @return bool True if SMTP connection is established and open, false otherwise + */ + protected function isSMTPConnected(): bool + { + return $this->SMTPConnect !== null && get_debug_type($this->SMTPConnect) !== 'resource (closed)'; + } } From 04f5b42af74d9f4840168c7e41f6f4370b1fa352 Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 29 Jul 2025 20:16:55 +0200 Subject: [PATCH 07/12] update the isSMTPConnected() method to also check for a false value --- system/Email/Email.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/Email/Email.php b/system/Email/Email.php index a11dd2a950cf..e450e2b1b1ef 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -2292,6 +2292,8 @@ protected function setArchiveValues(): array */ protected function isSMTPConnected(): bool { - return $this->SMTPConnect !== null && get_debug_type($this->SMTPConnect) !== 'resource (closed)'; + return $this->SMTPConnect !== null + && $this->SMTPConnect !== false + && get_debug_type($this->SMTPConnect) !== 'resource (closed)'; } } From 2f6ca33ea3e27a2d09b547d8417755ca64b10ccb Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Wed, 30 Jul 2025 07:02:03 +0700 Subject: [PATCH 08/12] fix: update preload exlude `util_bootstrap` (#9649) --- preload.php | 1 + 1 file changed, 1 insertion(+) diff --git a/preload.php b/preload.php index 86322d5e7137..9d16bb31554f 100644 --- a/preload.php +++ b/preload.php @@ -57,6 +57,7 @@ class preload '/system/Config/Routes.php', '/system/Language/', '/system/bootstrap.php', + '/system/util_bootstrap.php', '/system/rewrite.php', '/Views/', // Errors occur. From d32b8572689787bd8efb44573aa947e986bc6fa6 Mon Sep 17 00:00:00 2001 From: michalsn Date: Wed, 30 Jul 2025 08:50:09 +0200 Subject: [PATCH 09/12] update phpdoc for the SMTPConnect property --- system/Email/Email.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Email/Email.php b/system/Email/Email.php index e450e2b1b1ef..9ed8465daa66 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -263,7 +263,7 @@ class Email /** * SMTP Connection socket placeholder * - * @var resource|null + * @var false|resource|null */ protected $SMTPConnect; From 2e8091ec67d3ac1cb344d7aa9b1d90e4f1960ca4 Mon Sep 17 00:00:00 2001 From: michalsn Date: Wed, 30 Jul 2025 08:52:06 +0200 Subject: [PATCH 10/12] cs fix --- system/Debug/Toolbar/Collectors/Routes.php | 2 +- system/Router/RouteCollection.php | 2 +- system/Test/Mock/MockConnection.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/system/Debug/Toolbar/Collectors/Routes.php b/system/Debug/Toolbar/Collectors/Routes.php index 47c808e7ac40..f8005065c57e 100644 --- a/system/Debug/Toolbar/Collectors/Routes.php +++ b/system/Debug/Toolbar/Collectors/Routes.php @@ -51,7 +51,7 @@ class Routes extends BaseCollector * Returns the data of this collector to be formatted in the toolbar * * @return array{ - * matchedRoute: array, namespace?: string, hostname?: string, + * filter?: list|string, namespace?: string, hostname?: string, * subdomain?: string, offset?: int, priority?: int, as?: string, * redirect?: int * } diff --git a/system/Test/Mock/MockConnection.php b/system/Test/Mock/MockConnection.php index 2801a0674ad5..d14160595333 100644 --- a/system/Test/Mock/MockConnection.php +++ b/system/Test/Mock/MockConnection.php @@ -27,8 +27,8 @@ class MockConnection extends BaseConnection { /** * @var array{ - * connect?: object|resource|false|list, - * execute?: object|resource|false, + * connect?: false|list|object|resource, + * execute?: false|object|resource, * } */ protected $returnValues = []; From 9973d05c200d2a71b132ec4c892df5bccd55f736 Mon Sep 17 00:00:00 2001 From: Michal Sniatala Date: Fri, 1 Aug 2025 21:08:54 +0200 Subject: [PATCH 11/12] refactor: phpdoc for `Config\Filters::$globals` (#9652) * refactor: phpdoc for Config\Filters::$globals * refactor: phpdoc for Config\Filters::$globals Co-authored-by: John Paul E. Balandan, CPA --------- Co-authored-by: John Paul E. Balandan, CPA --- app/Config/Filters.php | 5 ++++- system/Config/Filters.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Config/Filters.php b/app/Config/Filters.php index eb46a1d7cee8..9c83ae94e55c 100644 --- a/app/Config/Filters.php +++ b/app/Config/Filters.php @@ -65,7 +65,10 @@ class Filters extends BaseFilters * List of filter aliases that are always * applied before and after every request. * - * @var array>>|array> + * @var array{ + * before: array|string}>|list, + * after: array|string}>|list + * } */ public array $globals = [ 'before' => [ diff --git a/system/Config/Filters.php b/system/Config/Filters.php index 7eddc721bff6..80662ede4bb3 100644 --- a/system/Config/Filters.php +++ b/system/Config/Filters.php @@ -78,7 +78,10 @@ class Filters extends BaseConfig * List of filter aliases that are always * applied before and after every request. * - * @var array>>|array> + * @var array{ + * before: array|string}>|list, + * after: array|string}>|list + * } */ public array $globals = [ 'before' => [ From 37a794c05c7b000c7e7ee3d1b4ab79a582c4606a Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 2 Aug 2025 21:17:49 +0800 Subject: [PATCH 12/12] Prep for 4.6.3 release (#9653) --- CHANGELOG.md | 13 +++++++++++++ phpdoc.dist.xml | 2 +- system/CodeIgniter.php | 2 +- user_guide_src/source/changelogs/v4.6.3.rst | 18 +----------------- user_guide_src/source/conf.py | 2 +- .../source/installation/upgrade_463.rst | 17 +++-------------- 6 files changed, 20 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aafcb2d746b6..76e89d04e4ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [v4.6.3](https://github.com/codeigniter4/CodeIgniter4/tree/v4.6.3) (2025-08-02) +[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.6.2...v4.6.3) + +### Fixed Bugs + +* fix: CID check in Email class by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9645 +* fix: SMTP connection resource validation in `Email` class destructor by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9648 + +### Refactoring + +* refactor: update preload script to exclude `util_bootstrap` by @ddevsr in https://github.com/codeigniter4/CodeIgniter4/pull/9649 +* refactor: phpdoc for `Config\Filters::$globals` by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9652 + ## [v4.6.2](https://github.com/codeigniter4/CodeIgniter4/tree/v4.6.2) (2025-07-26) [Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.6.1...v4.6.2) diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml index b2df39d10bca..0238aec5f019 100644 --- a/phpdoc.dist.xml +++ b/phpdoc.dist.xml @@ -10,7 +10,7 @@ api/build/ api/cache/ - + system diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 3c81f64c04cd..c87ff78e8348 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -55,7 +55,7 @@ class CodeIgniter /** * The current version of CodeIgniter Framework */ - public const CI_VERSION = '4.6.2'; + public const CI_VERSION = '4.6.3'; /** * App startup time. diff --git a/user_guide_src/source/changelogs/v4.6.3.rst b/user_guide_src/source/changelogs/v4.6.3.rst index ae525e52c3f8..90d0f8f42b37 100644 --- a/user_guide_src/source/changelogs/v4.6.3.rst +++ b/user_guide_src/source/changelogs/v4.6.3.rst @@ -2,7 +2,7 @@ Version 4.6.3 ############# -Release Date: Unreleased +Release Date: August 2, 2025 **4.6.3 release of CodeIgniter4** @@ -10,22 +10,6 @@ Release Date: Unreleased :local: :depth: 3 -******** -BREAKING -******** - -*************** -Message Changes -*************** - -******* -Changes -******* - -************ -Deprecations -************ - ********** Bugs Fixed ********** diff --git a/user_guide_src/source/conf.py b/user_guide_src/source/conf.py index 77166f7e014d..cf180802770c 100644 --- a/user_guide_src/source/conf.py +++ b/user_guide_src/source/conf.py @@ -26,7 +26,7 @@ version = '4.6' # The full version, including alpha/beta/rc tags. -release = '4.6.2' +release = '4.6.3' # -- General configuration --------------------------------------------------- diff --git a/user_guide_src/source/installation/upgrade_463.rst b/user_guide_src/source/installation/upgrade_463.rst index 9d94c298600a..cbadc5ee89b3 100644 --- a/user_guide_src/source/installation/upgrade_463.rst +++ b/user_guide_src/source/installation/upgrade_463.rst @@ -12,18 +12,6 @@ Please refer to the upgrade instructions corresponding to your installation meth :local: :depth: 2 -********************** -Mandatory File Changes -********************** - -**************** -Breaking Changes -**************** - -********************* -Breaking Enhancements -********************* - ************* Project Files ************* @@ -44,7 +32,7 @@ and it is recommended that you merge the updated versions with your application: Config ------ -- @TODO +- app/Config/Filters.php All Changes =========== @@ -52,4 +40,5 @@ All Changes This is a list of all files in the **project space** that received changes; many will be simple comments or formatting that have no effect on the runtime: -- @TODO +- app/Config/Filters.php +- preload.php