From 5574b44c986973e88fd3a08f91a76b78248a9a4b Mon Sep 17 00:00:00 2001 From: grimpirate Date: Sat, 18 Feb 2023 16:48:00 -0500 Subject: [PATCH 001/138] Typographic correction. --- user_guide_src/source/dbmgmt/forge.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/dbmgmt/forge.rst b/user_guide_src/source/dbmgmt/forge.rst index 21da852e9d4f..668325da0fa4 100644 --- a/user_guide_src/source/dbmgmt/forge.rst +++ b/user_guide_src/source/dbmgmt/forge.rst @@ -198,7 +198,7 @@ you may add them directly in forge: .. literalinclude:: forge/012.php -You can specify the desired action for the "on update" and "on update" properties of the constraint as well as the name: +You can specify the desired action for the "on delete" and "on update" properties of the constraint as well as the name: .. literalinclude:: forge/013.php From 246a7af6c26cae17adbe4a88d001ab89fc186a74 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 19 Feb 2023 09:01:04 +0900 Subject: [PATCH 002/138] docs: fix incorrect sample value for 'cipher' --- user_guide_src/source/libraries/encryption/010.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/encryption/010.php b/user_guide_src/source/libraries/encryption/010.php index 1bc9ebbbb2a5..53bcceac5fe5 100644 --- a/user_guide_src/source/libraries/encryption/010.php +++ b/user_guide_src/source/libraries/encryption/010.php @@ -1,3 +1,3 @@ initialize(['cipher' => '3des']); +$encrypter = $encryption->initialize(['cipher' => 'AES-256-CTR']); From bc297ffa902dc6ce33df9462d518638c592284ab Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 19 Feb 2023 09:02:41 +0900 Subject: [PATCH 003/138] config: add missing $cipher --- app/Config/Encryption.php | 9 +++++++++ tests/system/Encryption/EncryptionTest.php | 20 ++++++++++++++++++- .../source/libraries/encryption.rst | 17 ++++++++-------- .../source/libraries/encryption/013.php | 8 ++++++-- 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/app/Config/Encryption.php b/app/Config/Encryption.php index e37b4e2a14ec..28344134aa31 100644 --- a/app/Config/Encryption.php +++ b/app/Config/Encryption.php @@ -80,4 +80,13 @@ class Encryption extends BaseConfig * Set to 'authentication' for CI3 Encryption compatibility. */ public string $authKeyInfo = ''; + + /** + * Cipher to use. + * This setting is only used by OpenSSLHandler. + * + * Set to 'AES-128-CBC' to decrypt encrypted data that encrypted + * by CI3 Encryption default configuration. + */ + public string $cipher = 'AES-256-CTR'; } diff --git a/tests/system/Encryption/EncryptionTest.php b/tests/system/Encryption/EncryptionTest.php index b93183d96c1d..cbdccd2fbbe1 100644 --- a/tests/system/Encryption/EncryptionTest.php +++ b/tests/system/Encryption/EncryptionTest.php @@ -151,7 +151,25 @@ public function testMagicGetMissing() $this->assertNull($this->encryption->bogus); } - public function testDecryptEncryptedDataByCI3() + public function testDecryptEncryptedDataByCI3AES128CBC() + { + $config = new EncryptionConfig(); + $config->driver = 'OpenSSL'; + $config->key = hex2bin('64c70b0b8d45b80b9eba60b8b3c8a34d0193223d20fea46f8644b848bf7ce67f'); + $config->cipher = 'AES-128-CBC'; // CI3's default config + $config->rawData = false; + $config->encryptKeyInfo = 'encryption'; + $config->authKeyInfo = 'authentication'; + $encrypter = Services::encrypter($config, false); + + $encrypted = '211c55b9d1948187557bff88c1e77e0f6b965e3711d477d97fb0b60907a7336028714dbb8dfe90598039e9bc7147b54e552d739b378cd864fb91dde9ad6d4ffalIvVxFDDLTPBYGaHLNDzUSJExBKbQJ0NW27KDaR83bYqz8MDz/mXXpE+HHdaWjEE'; + $decrypted = $encrypter->decrypt($encrypted); + + $expected = 'This is a plain-text message.'; + $this->assertSame($expected, $decrypted); + } + + public function testDecryptEncryptedDataByCI3AES256CTR() { $config = new EncryptionConfig(); $config->driver = 'OpenSSL'; diff --git a/user_guide_src/source/libraries/encryption.rst b/user_guide_src/source/libraries/encryption.rst index 86fbbb32eb6f..8c7a200d94eb 100644 --- a/user_guide_src/source/libraries/encryption.rst +++ b/user_guide_src/source/libraries/encryption.rst @@ -61,17 +61,18 @@ Configuring the Library The example above uses the configuration settings found in **app/Config/Encryption.php**. -============== ======================================================== +============== ========================================================================== Option Possible values (default in parentheses) -============== ======================================================== +============== ========================================================================== key Encryption key starter driver Preferred handler, e.g., OpenSSL or Sodium (``OpenSSL``) -blockSize Padding length in bytes for SodiumHandler (``16``) digest Message digest algorithm (``SHA512``) -encryptKeyInfo Encryption key info (``''``). This is only used by OpenSSLHandler. -authKeyInfo Authentication key info (``''``). This is only used by OpenSSLHandler. -rawData Whether the cipher-text should be raw (``true``). This is only used by OpenSSLHandler. -============== ======================================================== +blockSize [**SodiumHandler** only] Padding length in bytes (``16``) +cipher [**OpenSSLHandler** only] Cipher to use (``AES-256-CTR``) +encryptKeyInfo [**OpenSSLHandler** only] Encryption key info (``''``) +authKeyInfo [**OpenSSLHandler** only] Authentication key info (``''``) +rawData [**OpenSSLHandler** only] Whether the cipher-text should be raw (``true``) +============== ========================================================================== You can replace the config file's settings by passing a configuration object of your own to the ``Services`` call. The ``$config`` variable must be @@ -281,7 +282,7 @@ Class Reference Please refer to the :ref:`configuration` section for detailed info. -.. php:interface:: CodeIgniter\\Encryption\\EncrypterInterface +.. php:interface:: CodeIgniter\Encryption\EncrypterInterface .. php:method:: encrypt($data[, $params = null]) diff --git a/user_guide_src/source/libraries/encryption/013.php b/user_guide_src/source/libraries/encryption/013.php index badfb04fdcc8..c49d282f42da 100644 --- a/user_guide_src/source/libraries/encryption/013.php +++ b/user_guide_src/source/libraries/encryption/013.php @@ -5,8 +5,12 @@ $config = new Encryption(); $config->driver = 'OpenSSL'; -// Your CI3's encryption_key -$config->key = hex2bin('64c70b0b8d45b80b9eba60b8b3c8a34d0193223d20fea46f8644b848bf7ce67f'); + +// Your CI3's 'encryption_key' +$config->key = hex2bin('64c70b0b8d45b80b9eba60b8b3c8a34d0193223d20fea46f8644b848bf7ce67f'); +// Your CI3's 'cipher' and 'mode' +$config->cipher = 'AES-128-CBC'; + $config->rawData = false; $config->encryptKeyInfo = 'encryption'; $config->authKeyInfo = 'authentication'; From 24438f50eea55b250a95bc2cb7b49673907efb50 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 19 Feb 2023 09:18:36 +0900 Subject: [PATCH 004/138] docs: add changelog and upgrading --- user_guide_src/source/changelogs/index.rst | 1 + user_guide_src/source/changelogs/v4.3.3.rst | 32 ++++++++++++ .../source/installation/upgrade_433.rst | 49 +++++++++++++++++++ .../source/installation/upgrading.rst | 1 + 4 files changed, 83 insertions(+) create mode 100644 user_guide_src/source/changelogs/v4.3.3.rst create mode 100644 user_guide_src/source/installation/upgrade_433.rst diff --git a/user_guide_src/source/changelogs/index.rst b/user_guide_src/source/changelogs/index.rst index 9932e8725891..bb2dae1ce3b1 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.3.3 v4.3.2 v4.3.1 v4.3.0 diff --git a/user_guide_src/source/changelogs/v4.3.3.rst b/user_guide_src/source/changelogs/v4.3.3.rst new file mode 100644 index 000000000000..6be500a3a589 --- /dev/null +++ b/user_guide_src/source/changelogs/v4.3.3.rst @@ -0,0 +1,32 @@ +Version 4.3.3 +################# + +Release Date: Unreleased + +**4.3.3 release of CodeIgniter4** + +.. contents:: + :local: + :depth: 3 + +BREAKING +******** + +Message Changes +*************** + +Changes +******* + +Deprecations +************ + +Bugs Fixed +********** + +- **Config:** Added missing ``Config\Encryption::$cipher``. +- **UserGuide:** Fixed the sample code for :ref:`encryption-compatible-with-ci3`. + +See the repo's +`CHANGELOG.md `_ +for a complete list of bugs fixed. diff --git a/user_guide_src/source/installation/upgrade_433.rst b/user_guide_src/source/installation/upgrade_433.rst new file mode 100644 index 000000000000..2196484b502b --- /dev/null +++ b/user_guide_src/source/installation/upgrade_433.rst @@ -0,0 +1,49 @@ +############################## +Upgrading from 4.3.2 to 4.3.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 + +Breaking Changes +**************** + +Mandatory File Changes +********************** + +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. + +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 +------ + +- app/Config/Encryption.php + - The missing property ``$cipher`` is added for CI3 + Encryption compatibility. See :ref:`encryption-compatible-with-ci3`. + +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 d754d020b55c..075c463fc81e 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_433 upgrade_432 upgrade_431 upgrade_430 From 217400702d90b47debb08626dbb37d74e616f6ea Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 19 Feb 2023 09:37:04 +0900 Subject: [PATCH 005/138] docs: remove duplicated `for` --- user_guide_src/source/installation/upgrade_430.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/upgrade_430.rst b/user_guide_src/source/installation/upgrade_430.rst index 6e37811777fe..c91aa82c723e 100644 --- a/user_guide_src/source/installation/upgrade_430.rst +++ b/user_guide_src/source/installation/upgrade_430.rst @@ -324,7 +324,7 @@ Config - The property ``$html5`` to determine whether to remove the solidus (``/``) character for void HTML elements (e.g. ````) is added, and set to ``true`` by default for HTML5 compatibility. - app/Config/Encryption.php - - The new property ``$rawData``, ``$encryptKeyInfo``, and ``$authKeyInfo`` are added for for CI3 + - The new property ``$rawData``, ``$encryptKeyInfo``, and ``$authKeyInfo`` are added for CI3 Encryption compatibility. See :ref:`encryption-compatible-with-ci3`. - app/Config/Exceptions.php - Two additional public properties were added: ``$logDeprecations`` and ``$deprecationLogLevel``. From 393040da48d6849b7541eda6c7a774562119c42f Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 19 Feb 2023 09:43:57 +0900 Subject: [PATCH 006/138] docs: add missing "Full Changelog:" --- admin/RELEASE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/admin/RELEASE.md b/admin/RELEASE.md index cfa7fe3bcdb6..63e7a7f661e6 100644 --- a/admin/RELEASE.md +++ b/admin/RELEASE.md @@ -85,6 +85,8 @@ See the changelog: https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHA ## New Contributors * + +Full Changelog: https://github.com/codeigniter4/CodeIgniter4/compare/v4.x.x...v4.x.x ``` * Watch for the "Deploy Distributable Repos" action to make sure **framework**, **appstarter**, and **userguide** get updated * Run the following commands to install and test `appstarter` and verify the new version: From dfe0334315938f32af957ae6bbf59a1e78062422 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 19 Feb 2023 09:44:31 +0900 Subject: [PATCH 007/138] docs: break long lines --- admin/RELEASE.md | 70 +++++++++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/admin/RELEASE.md b/admin/RELEASE.md index 63e7a7f661e6..b38abc95b7e2 100644 --- a/admin/RELEASE.md +++ b/admin/RELEASE.md @@ -16,7 +16,8 @@ If you release a new minor version. ## Changelog -When generating the changelog each Pull Request to be included must have one of the following [labels](https://github.com/codeigniter4/CodeIgniter4/labels): +When generating the changelog each Pull Request to be included must have one of +the following [labels](https://github.com/codeigniter4/CodeIgniter4/labels): - **bug** ... PRs that fix bugs - **enhancement** ... PRs to improve existing functionalities - **new feature** ... PRs for new features @@ -27,7 +28,8 @@ PRs with breaking changes must have the following additional label: ### Generate Changelog -To auto-generate, navigate to the [Releases](https://github.com/codeigniter4/CodeIgniter4/releases) page, +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) @@ -39,31 +41,41 @@ 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. +Copy the resulting content into **CHANGELOG.md** and adjust the format to match +the existing content. ## Preparation * Work off direct clones of the repos so the release branches persist for a time -* Clone both **codeigniter4/CodeIgniter4** and **codeigniter4/userguide** and resolve any necessary PRs +* Clone both **codeigniter4/CodeIgniter4** and **codeigniter4/userguide** and + resolve any necessary PRs ```console git clone git@github.com:codeigniter4/CodeIgniter4.git git clone git@github.com:codeigniter4/userguide.git ``` -* Vet the **admin/** folders for any removed hidden files (Action deploy scripts *do not remove these*) +* Vet the **admin/** folders for any removed hidden files (Action deploy scripts + *do not remove these*) * Merge any Security Advisory PRs in private forks ## Process -> Note: Most changes that need noting in the User Guide and docs should have been included -> with their PR, so this process assumes you will not be generating much new content. +> **Note** Most changes that need noting in the User Guide and docs should have +> been included with their PR, so this process assumes you will not be +> generating much new content. * Create a new branch `release-4.x.x` -* Update **system/CodeIgniter.php** with the new version number: `const CI_VERSION = '4.x.x';` -* Update **user_guide_src/source/conf.py** with the new `version = '4.x'` (if applicable) and `release = '4.x.x'` +* Update **system/CodeIgniter.php** with the new version number: + `const CI_VERSION = '4.x.x';` +* Update **user_guide_src/source/conf.py** with the new `version = '4.x'` (if applicable) + and `release = '4.x.x'` * Replace **CHANGELOG.md** with the new version generated above -* Set the date in **user_guide_src/source/changelogs/{version}.rst** to format `Release Date: January 31, 2021` -* Create a new changelog for the next version at **user_guide_src/source/changelogs/{next_version}.rst** and add it to **index.rst** -* Create **user_guide_src/source/installation/upgrade_{ver}.rst**, fill in the "All Changes" section, and add it to **upgrading.rst** +* Set the date in **user_guide_src/source/changelogs/{version}.rst** to format + `Release Date: January 31, 2021` +* Create a new changelog for the next version at + **user_guide_src/source/changelogs/{next_version}.rst** and add it to + **index.rst** +* Create **user_guide_src/source/installation/upgrade_{ver}.rst**, fill in the + "All Changes" section, and add it to **upgrading.rst** * git diff --name-status master -- . ':!system' * Commit the changes with "Prep for 4.x.x release" and push to origin * Create a new PR from `release-4.x.x` to `develop`: @@ -88,8 +100,10 @@ See the changelog: https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHA Full Changelog: https://github.com/codeigniter4/CodeIgniter4/compare/v4.x.x...v4.x.x ``` -* Watch for the "Deploy Distributable Repos" action to make sure **framework**, **appstarter**, and **userguide** get updated -* Run the following commands to install and test `appstarter` and verify the new version: +* Watch for the "Deploy Distributable Repos" action to make sure **framework**, + **appstarter**, and **userguide** get updated +* Run the following commands to install and test `appstarter` and verify the new + version: ```console composer create-project codeigniter4/appstarter release-test cd release-test @@ -123,22 +137,28 @@ 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 - * The content is somewhat organic, but should include any major features and changes as well as a link to the User Guide's changelog +* 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 + * The content is somewhat organic, but should include any major features and + changes as well as a link to the User Guide's changelog ## After Publishing Security Advisory * Send a PR to [PHP Security Advisories Database](https://github.com/FriendsOfPHP/security-advisories). * E.g. https://github.com/FriendsOfPHP/security-advisories/pull/606 * See https://github.com/FriendsOfPHP/security-advisories#contributing - * Don't forget to run `php -d memory_limit=-1 validator.php`, before submitting the PR + * Don't forget to run `php -d memory_limit=-1 validator.php`, before + submitting the PR ## Appendix ### Sphinx Installation -You may need to install Sphinx and its dependencies prior to building the User Guide. +You may need to install Sphinx and its dependencies prior to building the User +Guide. + This worked seamlessly on Ubuntu 20.04: ```console sudo apt install python3-sphinx @@ -154,8 +174,10 @@ sudo pip3 install sphinx_rtd_theme * Build the ePub version of the User Guide: `make epub` * Switch to the **userguide** repo and create a new branch `release-4.x.x` * Replace **docs/** with **CodeIgniter4/user_guide_src/build/html** -* Ensure the file **docs/.nojekyll** exists or GitHub Pages will ignore folders with an underscore prefix -* Copy **CodeIgniter4/user_guide_src/build/epub/CodeIgniter.epub** to **./CodeIgniter4.x.x.epub** +* Ensure the file **docs/.nojekyll** exists or GitHub Pages will ignore folders + with an underscore prefix +* Copy **CodeIgniter4/user_guide_src/build/epub/CodeIgniter.epub** to + **./CodeIgniter4.x.x.epub** * Commit the changes with "Update for 4.x.x" and push to origin * Create a new PR from `release-4.x.x` to `develop`: * Title: "Update for 4.x.x" @@ -167,6 +189,6 @@ sudo pip3 install sphinx_rtd_theme * Description: "CodeIgniter 4.x.x User Guide" * Watch for the "github pages" Environment to make sure the deployment succeeds -The User Guide website should update itself via the deploy GitHub Action. Should this fail -the server must be updated manually. See repo and hosting details in the deploy script -at the User Guide repo. +The User Guide website should update itself via the deploy GitHub Action. Should +this fail the server must be updated manually. See repo and hosting details in +the deploy script at the User Guide repo. From d195c772a86ca67e2720c2f774723f33ee42c68f Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 19 Feb 2023 09:55:16 +0900 Subject: [PATCH 008/138] docs: update branch for checking "All Changes" In case you forgot to update your local master branch. --- admin/RELEASE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/RELEASE.md b/admin/RELEASE.md index b38abc95b7e2..0896a1290698 100644 --- a/admin/RELEASE.md +++ b/admin/RELEASE.md @@ -76,7 +76,7 @@ git clone git@github.com:codeigniter4/userguide.git **index.rst** * Create **user_guide_src/source/installation/upgrade_{ver}.rst**, fill in the "All Changes" section, and add it to **upgrading.rst** - * git diff --name-status master -- . ':!system' + * git diff --name-status origin/master -- . ':!system' * Commit the changes with "Prep for 4.x.x release" and push to origin * Create a new PR from `release-4.x.x` to `develop`: * Title: "Prep for 4.x.x release" From 770d9c221b53f973d7956d115efd4e48cbb28799 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 19 Feb 2023 10:06:08 +0900 Subject: [PATCH 009/138] docs: remove incorrect section title --- user_guide_src/source/installation/upgrade_432.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/user_guide_src/source/installation/upgrade_432.rst b/user_guide_src/source/installation/upgrade_432.rst index adb40380aedc..68bb80f0dbed 100644 --- a/user_guide_src/source/installation/upgrade_432.rst +++ b/user_guide_src/source/installation/upgrade_432.rst @@ -64,9 +64,6 @@ 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 ------- - - app/Config/Email.php - app/Config/Mimes.php - app/Views/errors/html/error_exception.php From ef2dd3cad6cccb8efc751e45171c5024dda96b4b Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 19 Feb 2023 10:06:38 +0900 Subject: [PATCH 010/138] docs: remove incorrect Project Files app/Config/Email.php is not changed. The master branch in my repos was not updated. --- user_guide_src/source/installation/upgrade_432.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/user_guide_src/source/installation/upgrade_432.rst b/user_guide_src/source/installation/upgrade_432.rst index 68bb80f0dbed..0e8a818124d3 100644 --- a/user_guide_src/source/installation/upgrade_432.rst +++ b/user_guide_src/source/installation/upgrade_432.rst @@ -64,7 +64,6 @@ 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: -- app/Config/Email.php - app/Config/Mimes.php - app/Views/errors/html/error_exception.php - composer.json @@ -77,7 +76,6 @@ 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: - app/Config/App.php -- app/Config/Email.php - app/Config/Mimes.php - app/Views/errors/html/error_exception.php - composer.json From 5c6f468f03f817f1cd63b045a5690e231cced2e9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 19 Feb 2023 14:06:55 +0900 Subject: [PATCH 011/138] fix: RawSql causes error when using like() and countAllResults() --- system/Database/BaseBuilder.php | 4 ++++ tests/system/Database/Live/LikeTest.php | 29 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 653f43013f15..31234f9edf1a 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -3082,6 +3082,10 @@ protected function compileWhereHaving(string $qbKey): string continue; } + if ($qbkey instanceof RawSql) { + continue; + } + if ($qbkey['condition'] instanceof RawSql) { $qbkey = $qbkey['condition']; diff --git a/tests/system/Database/Live/LikeTest.php b/tests/system/Database/Live/LikeTest.php index f192d4a0f224..379de0cf1820 100644 --- a/tests/system/Database/Live/LikeTest.php +++ b/tests/system/Database/Live/LikeTest.php @@ -11,6 +11,7 @@ namespace CodeIgniter\Database\Live; +use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -121,4 +122,32 @@ public function testLikeSpacesOrTabs() $this->assertCount(1, $spaces); $this->assertCount(1, $tabs); } + + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/7268 + */ + public function testLikeRawSqlAndCountAllResultsAndGet() + { + $builder = $this->db->table('job'); + $builder->like(new RawSql('name'), 'Developer'); + $count = $builder->countAllResults(false); + $results = $builder->get()->getResult(); + + $this->assertSame(1, $count); + $this->assertSame('Developer', $results[0]->name); + } + + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/7268 + */ + public function testLikeRawSqlAndGetAndCountAllResults() + { + $builder = $this->db->table('job'); + $builder->like(new RawSql('name'), 'Developer'); + $results = $builder->get(null, 0, false)->getResult(); + $count = $builder->countAllResults(); + + $this->assertSame(1, $count); + $this->assertSame('Developer', $results[0]->name); + } } From 0d8c914ced2c4197e7c7d6ea098904ee51eee4f9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 19 Feb 2023 14:39:03 +0900 Subject: [PATCH 012/138] test: fix for OCI8 --- tests/system/Database/Live/LikeTest.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/system/Database/Live/LikeTest.php b/tests/system/Database/Live/LikeTest.php index 379de0cf1820..fe616105a466 100644 --- a/tests/system/Database/Live/LikeTest.php +++ b/tests/system/Database/Live/LikeTest.php @@ -129,7 +129,14 @@ public function testLikeSpacesOrTabs() public function testLikeRawSqlAndCountAllResultsAndGet() { $builder = $this->db->table('job'); - $builder->like(new RawSql('name'), 'Developer'); + + if ($this->db->DBDriver === 'OCI8') { + $key = new RawSql('"name"'); + } else { + $key = new RawSql('name'); + } + + $builder->like($key, 'Developer'); $count = $builder->countAllResults(false); $results = $builder->get()->getResult(); @@ -143,7 +150,14 @@ public function testLikeRawSqlAndCountAllResultsAndGet() public function testLikeRawSqlAndGetAndCountAllResults() { $builder = $this->db->table('job'); - $builder->like(new RawSql('name'), 'Developer'); + + if ($this->db->DBDriver === 'OCI8') { + $key = new RawSql('"name"'); + } else { + $key = new RawSql('name'); + } + + $builder->like($key, 'Developer'); $results = $builder->get(null, 0, false)->getResult(); $count = $builder->countAllResults(); From c1d68ce00494bf51d851f6668e3313ca129e91a3 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 08:57:14 +0900 Subject: [PATCH 013/138] docs: make doc link paths relative --- user_guide_src/source/incoming/filters.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/incoming/filters.rst b/user_guide_src/source/incoming/filters.rst index ca63f38b391a..036c14ddd992 100644 --- a/user_guide_src/source/incoming/filters.rst +++ b/user_guide_src/source/incoming/filters.rst @@ -6,7 +6,7 @@ Controller Filters :local: :depth: 2 -Controller Filters allow you to perform actions either before or after the controllers execute. Unlike :doc:`events `, +Controller Filters allow you to perform actions either before or after the controllers execute. Unlike :doc:`events <../extending/events>`, you can choose the specific URIs in which the filters will be applied to. Incoming filters may modify the Request while after filters can act on and even modify the Response, allowing for a lot of flexibility and power. Some common examples of tasks that might be performed with filters are: @@ -60,7 +60,7 @@ This is typically used to perform redirects, like in this example: .. literalinclude:: filters/002.php If a ``Response`` instance is returned, the Response will be sent back to the client and script execution will stop. -This can be useful for implementing rate limiting for APIs. See :doc:`Throttler ` for an +This can be useful for implementing rate limiting for APIs. See :doc:`Throttler <../libraries/throttler>` for an example. .. _after-filters: @@ -165,7 +165,7 @@ In this example, the array ``['dual', 'noreturn']`` will be passed in ``$argumen Confirming Filters ****************** -CodeIgniter has the following :doc:`command ` to check the filters for a route. +CodeIgniter has the following :doc:`command <../cli/spark_commands>` to check the filters for a route. .. _spark-filter-check: From ab0acdc6153026ba496fcb552935ea583aa7f331 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 08:57:50 +0900 Subject: [PATCH 014/138] docs: add property types in sample code --- user_guide_src/source/incoming/filters/003.php | 2 +- user_guide_src/source/incoming/filters/004.php | 2 +- user_guide_src/source/incoming/filters/005.php | 4 +++- user_guide_src/source/incoming/filters/006.php | 4 +++- user_guide_src/source/incoming/filters/007.php | 4 +++- user_guide_src/source/incoming/filters/008.php | 4 +++- user_guide_src/source/incoming/filters/009.php | 4 +++- user_guide_src/source/incoming/filters/011.php | 2 +- 8 files changed, 18 insertions(+), 8 deletions(-) diff --git a/user_guide_src/source/incoming/filters/003.php b/user_guide_src/source/incoming/filters/003.php index 2e7770e88ddd..af170fa37ac0 100644 --- a/user_guide_src/source/incoming/filters/003.php +++ b/user_guide_src/source/incoming/filters/003.php @@ -6,7 +6,7 @@ class Filters extends BaseConfig { - public $aliases = [ + public array $aliases = [ 'csrf' => \CodeIgniter\Filters\CSRF::class, ]; diff --git a/user_guide_src/source/incoming/filters/004.php b/user_guide_src/source/incoming/filters/004.php index c645d9f8191d..304bd21b53eb 100644 --- a/user_guide_src/source/incoming/filters/004.php +++ b/user_guide_src/source/incoming/filters/004.php @@ -6,7 +6,7 @@ class Filters extends BaseConfig { - public $aliases = [ + public array $aliases = [ 'apiPrep' => [ \App\Filters\Negotiate::class, \App\Filters\ApiAuth::class, diff --git a/user_guide_src/source/incoming/filters/005.php b/user_guide_src/source/incoming/filters/005.php index 226db2389c58..8b00ce682b1b 100644 --- a/user_guide_src/source/incoming/filters/005.php +++ b/user_guide_src/source/incoming/filters/005.php @@ -6,7 +6,9 @@ class Filters extends BaseConfig { - public $globals = [ + // ... + + public array $globals = [ 'before' => [ 'csrf', ], diff --git a/user_guide_src/source/incoming/filters/006.php b/user_guide_src/source/incoming/filters/006.php index bfddf66c3c4e..a7f4336a635f 100644 --- a/user_guide_src/source/incoming/filters/006.php +++ b/user_guide_src/source/incoming/filters/006.php @@ -6,7 +6,9 @@ class Filters extends BaseConfig { - public $globals = [ + // ... + + public array $globals = [ 'before' => [ 'csrf' => ['except' => 'api/*'], ], diff --git a/user_guide_src/source/incoming/filters/007.php b/user_guide_src/source/incoming/filters/007.php index d7f21efa1344..b3c9cc8ed996 100644 --- a/user_guide_src/source/incoming/filters/007.php +++ b/user_guide_src/source/incoming/filters/007.php @@ -6,7 +6,9 @@ class Filters extends BaseConfig { - public $globals = [ + // ... + + public array $globals = [ 'before' => [ 'csrf' => ['except' => ['foo/*', 'bar/*']], ], diff --git a/user_guide_src/source/incoming/filters/008.php b/user_guide_src/source/incoming/filters/008.php index 1d99d0226a79..749da8098c6b 100644 --- a/user_guide_src/source/incoming/filters/008.php +++ b/user_guide_src/source/incoming/filters/008.php @@ -6,7 +6,9 @@ class Filters extends BaseConfig { - public $methods = [ + // ... + + public array $methods = [ 'post' => ['foo', 'bar'], 'get' => ['baz'], ]; diff --git a/user_guide_src/source/incoming/filters/009.php b/user_guide_src/source/incoming/filters/009.php index 162af6dcbaec..274a4cb6256b 100644 --- a/user_guide_src/source/incoming/filters/009.php +++ b/user_guide_src/source/incoming/filters/009.php @@ -6,7 +6,9 @@ class Filters extends BaseConfig { - public $filters = [ + // ... + + public array $filters = [ 'foo' => ['before' => ['admin/*'], 'after' => ['users/*']], 'bar' => ['before' => ['api/*', 'admin/*']], ]; diff --git a/user_guide_src/source/incoming/filters/011.php b/user_guide_src/source/incoming/filters/011.php index fa12db31a9e7..6c12e301ff6b 100644 --- a/user_guide_src/source/incoming/filters/011.php +++ b/user_guide_src/source/incoming/filters/011.php @@ -6,7 +6,7 @@ class Filters extends BaseConfig { - public $aliases = [ + public array $aliases = [ // ... 'secureheaders' => \App\Filters\SecureHeaders::class, ]; From 4a4e8d6048ef7901990d57e1cd8fbbed38404790 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 09:10:43 +0900 Subject: [PATCH 015/138] docs: make the first letter capital --- user_guide_src/source/incoming/filters.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/incoming/filters.rst b/user_guide_src/source/incoming/filters.rst index 036c14ddd992..b9c6b1c20c55 100644 --- a/user_guide_src/source/incoming/filters.rst +++ b/user_guide_src/source/incoming/filters.rst @@ -152,8 +152,8 @@ a list of URI patterns that filter should apply to: .. literalinclude:: filters/009.php -Filter arguments -================= +Filter Arguments +================ When configuring filters, additional arguments may be passed to a filter when setting up the route: From 7b05b725e77b0fb2821ac611dcc47d594a4e8248 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 09:11:19 +0900 Subject: [PATCH 016/138] docs: add sub section title --- user_guide_src/source/incoming/filters.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/user_guide_src/source/incoming/filters.rst b/user_guide_src/source/incoming/filters.rst index b9c6b1c20c55..80b6a908a43e 100644 --- a/user_guide_src/source/incoming/filters.rst +++ b/user_guide_src/source/incoming/filters.rst @@ -114,6 +114,9 @@ run on every request. Filters can be specified by adding their alias to either t .. literalinclude:: filters/005.php +Except for a Few URIs +--------------------- + There are times where you want to apply a filter to almost every request, but have a few that should be left alone. One common example is if you need to exclude a few URI's from the CSRF protection filter to allow requests from third-party websites to hit one or two specific URI's, while keeping the rest of them protected. To do this, add From 35029c5cc601eb560a09c9bad454483748cf1093 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 09:12:14 +0900 Subject: [PATCH 017/138] docs: text decration --- user_guide_src/source/incoming/filters.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/incoming/filters.rst b/user_guide_src/source/incoming/filters.rst index 80b6a908a43e..7acf229a4ded 100644 --- a/user_guide_src/source/incoming/filters.rst +++ b/user_guide_src/source/incoming/filters.rst @@ -120,7 +120,7 @@ Except for a Few URIs There are times where you want to apply a filter to almost every request, but have a few that should be left alone. One common example is if you need to exclude a few URI's from the CSRF protection filter to allow requests from third-party websites to hit one or two specific URI's, while keeping the rest of them protected. To do this, add -an array with the 'except' key and a URI to match as the value alongside the alias: +an array with the ``except`` key and a URI to match as the value alongside the alias: .. literalinclude:: filters/006.php @@ -150,7 +150,7 @@ all requests that were run from the command line. $filters ======== -This property is an array of filter aliases. For each alias, you can specify before and after arrays that contain +This property is an array of filter aliases. For each alias, you can specify ``before`` and ``after`` arrays that contain a list of URI patterns that filter should apply to: .. literalinclude:: filters/009.php From 40f994e8b05bb094d3d071da2b3a60a4b8e0a034 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 09:12:37 +0900 Subject: [PATCH 018/138] docs: add literal for asterisk --- user_guide_src/source/incoming/filters.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/incoming/filters.rst b/user_guide_src/source/incoming/filters.rst index 7acf229a4ded..dd8c9ac21d39 100644 --- a/user_guide_src/source/incoming/filters.rst +++ b/user_guide_src/source/incoming/filters.rst @@ -125,7 +125,7 @@ an array with the ``except`` key and a URI to match as the value alongside the a .. literalinclude:: filters/006.php Any place you can use a URI in the filter settings, you can use a regular expression or, like in this example, use -an asterisk for a wildcard that will match all characters after that. In this example, any URL's starting with ``api/`` +an asterisk (``*``) for a wildcard that will match all characters after that. In this example, any URL's starting with ``api/`` would be exempted from CSRF protection, but the site's forms would all be protected. If you need to specify multiple URI's you can use an array of URI patterns: From b7a62ee77de375a5121fbd9832b45b02fd6afba5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 09:13:31 +0900 Subject: [PATCH 019/138] docs: change paragraph structure --- user_guide_src/source/incoming/filters.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/user_guide_src/source/incoming/filters.rst b/user_guide_src/source/incoming/filters.rst index dd8c9ac21d39..cab286cf95fc 100644 --- a/user_guide_src/source/incoming/filters.rst +++ b/user_guide_src/source/incoming/filters.rst @@ -134,18 +134,20 @@ URI's you can use an array of URI patterns: $methods ======== +.. Warning:: If you use ``$methods`` filters, you should :ref:`disable Auto Routing (Legacy) ` + because :ref:`auto-routing-legacy` permits any HTTP method to access a controller. + Accessing the controller with a method you don't expect could bypass the filter. + You can apply filters to all requests of a certain HTTP method, like POST, GET, PUT, etc. In this array, you would -specify the method name in lowercase. It's value would be an array of filters to run. Unlike the ``$globals`` or the -``$filters`` properties, these will only run as before filters: +specify the method name in **lowercase**. It's value would be an array of filters to run: .. literalinclude:: filters/008.php -In addition to the standard HTTP methods, this also supports one special case: 'cli'. The 'cli' method would apply to -all requests that were run from the command line. +.. note:: Unlike the ``$globals`` or the + ``$filters`` properties, these will only run as before filters. -.. Warning:: If you use ``$methods`` filters, you should :ref:`disable Auto Routing (Legacy) ` - because :ref:`auto-routing-legacy` permits any HTTP method to access a controller. - Accessing the controller with a method you don't expect could bypass the filter. +In addition to the standard HTTP methods, this also supports one special case: ``cli``. The ``cli`` method would apply to +all requests that were run from the command line. $filters ======== From 62b43b9d6f6b1f13e22771236a88992ee2a8544c Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 09:31:02 +0900 Subject: [PATCH 020/138] docs: add TOC --- user_guide_src/source/incoming/content_negotiation.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/user_guide_src/source/incoming/content_negotiation.rst b/user_guide_src/source/incoming/content_negotiation.rst index ceb0ce866193..35185db029f3 100644 --- a/user_guide_src/source/incoming/content_negotiation.rst +++ b/user_guide_src/source/incoming/content_negotiation.rst @@ -9,6 +9,10 @@ is done by analyzing four different headers which can each support multiple valu Trying to match this up manually can be pretty challenging. CodeIgniter provides the ``Negotiator`` class that can handle this for you. +.. contents:: + :local: + :depth: 2 + ================= Loading the Class ================= From cccb3c57c52225a6cd8f977435baaf9de7d00341 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 09:32:32 +0900 Subject: [PATCH 021/138] docs: fix section title marks --- .../source/incoming/content_negotiation.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/user_guide_src/source/incoming/content_negotiation.rst b/user_guide_src/source/incoming/content_negotiation.rst index 35185db029f3..043a6cf7201f 100644 --- a/user_guide_src/source/incoming/content_negotiation.rst +++ b/user_guide_src/source/incoming/content_negotiation.rst @@ -1,6 +1,6 @@ -******************* +################### Content Negotiation -******************* +################### Content negotiation is a way to determine what type of content to return to the client based on what the client can handle, and what the server can handle. This can be used to determine whether the client is wanting HTML or JSON @@ -13,9 +13,9 @@ can handle this for you. :local: :depth: 2 -================= +***************** Loading the Class -================= +***************** You can load an instance of the class manually through the Service class: @@ -32,9 +32,9 @@ method: When accessed this way, the first parameter is the type of content you're trying to find a match for, while the second is an array of supported values. -=========== +*********** Negotiating -=========== +*********** In this section, we will discuss the 4 types of content that can be negotiated and show how that would look using both of the methods described above to access the negotiator. From 968f03f8c06c07a6402f009a6b2d185eebcb16fa Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 09:46:34 +0900 Subject: [PATCH 022/138] docs: fix section title marks --- user_guide_src/source/incoming/message.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/incoming/message.rst b/user_guide_src/source/incoming/message.rst index 411f53990162..8edc3e27fbef 100644 --- a/user_guide_src/source/incoming/message.rst +++ b/user_guide_src/source/incoming/message.rst @@ -1,6 +1,6 @@ -============= +############# HTTP Messages -============= +############# The Message class provides an interface to the portions of an HTTP message that are common to both requests and responses, including the message body, protocol version, utilities for working with From 23087c6dec524da935d28e604aa2cc38637cb997 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 09:48:17 +0900 Subject: [PATCH 023/138] docs: move "What is Content Negotiation?" to content_negotiation.rst --- .../source/incoming/content_negotiation.rst | 20 +++++++++++++++++++ user_guide_src/source/incoming/message.rst | 19 ------------------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/user_guide_src/source/incoming/content_negotiation.rst b/user_guide_src/source/incoming/content_negotiation.rst index 043a6cf7201f..a27754607503 100644 --- a/user_guide_src/source/incoming/content_negotiation.rst +++ b/user_guide_src/source/incoming/content_negotiation.rst @@ -13,6 +13,26 @@ can handle this for you. :local: :depth: 2 +**************************** +What is Content Negotiation? +**************************** + +At it's heart Content Negotiation is simply a part of the HTTP specification that allows a single +resource to serve more than one type of content, allowing the clients to request the type of +data that works best for them. + +A classic example of this is a browser that cannot display PNG files can request only GIF or +JPEG images. When the server receives the request, it looks at the available file types the client +is requesting and selects the best match from the image formats that it supports, in this case +likely choosing a JPEG image to return. + +This same negotiation can happen with four types of data: + +* **Media/Document Type** - this could be image format, or HTML vs. XML or JSON. +* **Character Set** - The character set the returned document should be set in. Typically is UTF-8. +* **Document Encoding** - Typically the type of compression used on the results. +* **Document Language** - For sites that support multiple languages, this helps determine which to return. + ***************** Loading the Class ***************** diff --git a/user_guide_src/source/incoming/message.rst b/user_guide_src/source/incoming/message.rst index 8edc3e27fbef..2a865c49b532 100644 --- a/user_guide_src/source/incoming/message.rst +++ b/user_guide_src/source/incoming/message.rst @@ -11,25 +11,6 @@ This class is the parent class that both the :doc:`Request Class Date: Mon, 20 Feb 2023 09:50:43 +0900 Subject: [PATCH 024/138] docs: remove incorrect out-of-dated description --- user_guide_src/source/incoming/message.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/user_guide_src/source/incoming/message.rst b/user_guide_src/source/incoming/message.rst index 2a865c49b532..3d52eb0ca765 100644 --- a/user_guide_src/source/incoming/message.rst +++ b/user_guide_src/source/incoming/message.rst @@ -7,9 +7,7 @@ requests and responses, including the message body, protocol version, utilities the headers, and methods for handling content negotiation. This class is the parent class that both the :doc:`Request Class ` and the -:doc:`Response Class ` extend from. As such, some methods, such as the content -negotiation methods, may apply only to a request or response, and not the other one, but they have -been included here to keep the header methods together. +:doc:`Response Class ` extend from. *************** Class Reference From eee7759e09ad27b2b1c16a2be43dc8cb5b1718d1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 09:52:05 +0900 Subject: [PATCH 025/138] docs: make doc link paths relative --- user_guide_src/source/incoming/message.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/incoming/message.rst b/user_guide_src/source/incoming/message.rst index 3d52eb0ca765..a575a4aa2765 100644 --- a/user_guide_src/source/incoming/message.rst +++ b/user_guide_src/source/incoming/message.rst @@ -6,8 +6,8 @@ The Message class provides an interface to the portions of an HTTP message that requests and responses, including the message body, protocol version, utilities for working with the headers, and methods for handling content negotiation. -This class is the parent class that both the :doc:`Request Class ` and the -:doc:`Response Class ` extend from. +This class is the parent class that both the :doc:`Request Class <../incoming/request>` and the +:doc:`Response Class <../outgoing/response>` extend from. *************** Class Reference @@ -47,7 +47,7 @@ Class Reference :returns: void Scans and parses the headers found in the SERVER data and stores it for later access. - This is used by the :doc:`IncomingRequest Class ` to make + This is used by the :doc:`IncomingRequest Class <../incoming/incomingrequest>` to make the current request's headers available. The headers are any SERVER data that starts with ``HTTP_``, like ``HTTP_HOST``. Each message From 53b4e7f47c27fb2ee40e3ef40d3d6c65620d2a6d Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Feb 2023 09:53:54 +0900 Subject: [PATCH 026/138] docs: move paragraph --- .../source/incoming/content_negotiation.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/user_guide_src/source/incoming/content_negotiation.rst b/user_guide_src/source/incoming/content_negotiation.rst index a27754607503..702bb40afe64 100644 --- a/user_guide_src/source/incoming/content_negotiation.rst +++ b/user_guide_src/source/incoming/content_negotiation.rst @@ -2,13 +2,6 @@ Content Negotiation ################### -Content negotiation is a way to determine what type of content to return to the client based on what the client -can handle, and what the server can handle. This can be used to determine whether the client is wanting HTML or JSON -returned, whether the image should be returned as a jpg or png, what type of compression is supported and more. This -is done by analyzing four different headers which can each support multiple value options, each with their own priority. -Trying to match this up manually can be pretty challenging. CodeIgniter provides the ``Negotiator`` class that -can handle this for you. - .. contents:: :local: :depth: 2 @@ -17,6 +10,14 @@ can handle this for you. What is Content Negotiation? **************************** +Content negotiation is a way to determine what type of content to return to the client based on what the client +can handle, and what the server can handle. This can be used to determine whether the client is wanting HTML or JSON +returned, whether the image should be returned as a JPEG or PNG, what type of compression is supported and more. This +is done by analyzing four different headers which can each support multiple value options, each with their own priority. + +Trying to match this up manually can be pretty challenging. CodeIgniter provides the ``Negotiator`` class that +can handle this for you. + At it's heart Content Negotiation is simply a part of the HTTP specification that allows a single resource to serve more than one type of content, allowing the clients to request the type of data that works best for them. From 1f5d0415dd255fd5e02ada995fea56c624926711 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Feb 2023 15:56:45 +0000 Subject: [PATCH 027/138] chore(deps-dev): update rector/rector requirement Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.16...0.15.17) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d0c2bd1e4dda..98fc97c5fc81 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "phpunit/phpcov": "^8.2", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1 || ^2.0", - "rector/rector": "0.15.16", + "rector/rector": "0.15.17", "vimeo/psalm": "^5.0" }, "suggest": { From 94fe3291561138150f70aba099b938a5feaaf5d1 Mon Sep 17 00:00:00 2001 From: grimpirate Date: Mon, 20 Feb 2023 23:31:09 -0500 Subject: [PATCH 028/138] Update user_guide_src/source/dbmgmt/forge.rst Co-authored-by: kenjis --- user_guide_src/source/dbmgmt/forge.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/dbmgmt/forge.rst b/user_guide_src/source/dbmgmt/forge.rst index 668325da0fa4..e55867cc287b 100644 --- a/user_guide_src/source/dbmgmt/forge.rst +++ b/user_guide_src/source/dbmgmt/forge.rst @@ -198,7 +198,7 @@ you may add them directly in forge: .. literalinclude:: forge/012.php -You can specify the desired action for the "on delete" and "on update" properties of the constraint as well as the name: +You can specify the desired action for the "on update" and "on delete" properties of the constraint as well as the name: .. literalinclude:: forge/013.php From dc0225e1a6073f86127f9e04b942b1caa26fc1be Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 21 Feb 2023 16:40:08 +0900 Subject: [PATCH 029/138] test: fix out-of-dated test code --- tests/system/CodeIgniterTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index 1a5e50fc0775..be66a072a0c1 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -709,9 +709,9 @@ public function testPageCacheSendSecureHeaders() public function testPageCacheWithCacheQueryString($cacheQueryStringValue, int $expectedPagesInCache, array $testingUrls) { // Suppress command() output - CITestStreamFilter::$buffer = ''; - $outputStreamFilter = stream_filter_append(STDOUT, 'CITestStreamFilter'); - $errorStreamFilter = stream_filter_append(STDERR, 'CITestStreamFilter'); + CITestStreamFilter::registration(); + CITestStreamFilter::addOutputFilter(); + CITestStreamFilter::addErrorFilter(); // Create cache config with cacheQueryString value from the dataProvider $cacheConfig = new Cache(); @@ -756,8 +756,8 @@ public function testPageCacheWithCacheQueryString($cacheQueryStringValue, int $e $this->assertSame($expectedPagesInCache, $newPagesCached); // Remove stream filters - stream_filter_remove($outputStreamFilter); - stream_filter_remove($errorStreamFilter); + CITestStreamFilter::removeOutputFilter(); + CITestStreamFilter::removeErrorFilter(); } public function cacheQueryStringProvider(): array From 0ed690876c8a95ee8673572a0a5f0db992c44459 Mon Sep 17 00:00:00 2001 From: Jozef Rebjak Date: Tue, 21 Feb 2023 08:52:56 +0100 Subject: [PATCH 030/138] docs: $systemDirectory path in existing project. --- user_guide_src/source/installation/installing_composer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/installing_composer.rst b/user_guide_src/source/installation/installing_composer.rst index 00f736dbe603..ca9eacf28314 100644 --- a/user_guide_src/source/installation/installing_composer.rst +++ b/user_guide_src/source/installation/installing_composer.rst @@ -152,7 +152,7 @@ Setting Up 1. Copy the **app**, **public**, **tests** and **writable** folders from **vendor/codeigniter4/framework** to your project root 2. Copy the **env**, **phpunit.xml.dist** and **spark** files, from **vendor/codeigniter4/framework** to your project root - 3. You will have to adjust the ``$systemDirectory`` property in **app/Config/Paths.php** to refer to the vendor one, e.g., ``ROOTPATH . '/vendor/codeigniter4/framework/system'``. + 3. You will have to adjust the ``$systemDirectory`` property in **app/Config/Paths.php** to refer to the vendor one, e.g., ``__DIR__ . '/../../vendor/codeigniter4/framework/system'``. Initial Configuration --------------------- From 13b6b0e2ad366716bca70b35c6da4840a046e894 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 09:58:07 +0900 Subject: [PATCH 031/138] refactor: initialize $files To suppress PHPStan error. --- system/Commands/Utilities/Routes/ControllerFinder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/system/Commands/Utilities/Routes/ControllerFinder.php b/system/Commands/Utilities/Routes/ControllerFinder.php index 7e7865876750..e7d828c0fe57 100644 --- a/system/Commands/Utilities/Routes/ControllerFinder.php +++ b/system/Commands/Utilities/Routes/ControllerFinder.php @@ -44,6 +44,7 @@ public function find(): array $nsArray = explode('\\', trim($this->namespace, '\\')); $count = count($nsArray); $ns = ''; + $files = []; for ($i = 0; $i < $count; $i++) { $ns .= '\\' . array_shift($nsArray); From d4e47a3497d9aaf87334728ee0f244ee4a8e4e75 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 09:58:53 +0900 Subject: [PATCH 032/138] chore: remove ignore patterns that are no longer needed --- phpstan-baseline.neon.dist | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/phpstan-baseline.neon.dist b/phpstan-baseline.neon.dist index 2d1f9ddd3c41..6fd838f0f174 100644 --- a/phpstan-baseline.neon.dist +++ b/phpstan-baseline.neon.dist @@ -20,11 +20,6 @@ parameters: count: 1 path: system/Cache/Handlers/FileHandler.php - - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 1 - path: system/Cache/Handlers/MemcachedHandler.php - - message: "#^Property CodeIgniter\\\\Cache\\\\Handlers\\\\RedisHandler\\:\\:\\$redis \\(Redis\\) in isset\\(\\) is not nullable\\.$#" count: 1 @@ -50,16 +45,6 @@ parameters: count: 1 path: system/Database/BaseConnection.php - - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 2 - path: system/Database/BaseResult.php - - - - message: "#^While loop condition is always true\\.$#" - count: 2 - path: system/Database/BaseResult.php - - message: "#^Access to an undefined property CodeIgniter\\\\Database\\\\ConnectionInterface\\:\\:\\$DBDriver\\.$#" count: 2 @@ -260,21 +245,11 @@ parameters: count: 1 path: system/Router/Router.php - - - message: "#^Strict comparison using \\=\\=\\= between string and true will always evaluate to false\\.$#" - count: 1 - path: system/Session/Handlers/RedisHandler.php - - message: "#^Property CodeIgniter\\\\Session\\\\Session\\:\\:\\$sessionExpiration \\(int\\) in isset\\(\\) is not nullable\\.$#" count: 1 path: system/Session/Session.php - - - message: "#^Negated boolean expression is always false\\.$#" - count: 1 - path: system/Test/CIUnitTestCase.php - - message: "#^Access to an undefined property object\\:\\:\\$createdField\\.$#" count: 1 From 4bbecfd201a57bcfa9c4a373df37aab3565f863e Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 21 Feb 2023 10:23:25 +0900 Subject: [PATCH 033/138] docs: add section title --- user_guide_src/source/concepts/autoloader.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/user_guide_src/source/concepts/autoloader.rst b/user_guide_src/source/concepts/autoloader.rst index ee2dc5a8a3d8..a285ab96de2a 100644 --- a/user_guide_src/source/concepts/autoloader.rst +++ b/user_guide_src/source/concepts/autoloader.rst @@ -13,6 +13,9 @@ classes that your project is using. Keeping track of where every single file is, hard-coding that location into your files in a series of ``requires()`` is a massive headache and very error-prone. That's where autoloaders come in. +CodeIgniter4 Autoloader +*********************** + CodeIgniter provides a very flexible autoloader that can be used with very little configuration. It can locate individual namespaced classes that adhere to `PSR-4 `_ autoloading From e92a9f652affbd615c14fa5a0107ae1f38347bdb Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 21 Feb 2023 10:23:42 +0900 Subject: [PATCH 034/138] docs: add note for case-sensitive file systems --- user_guide_src/source/concepts/autoloader.rst | 6 ++++++ user_guide_src/source/tutorial/static_pages.rst | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/user_guide_src/source/concepts/autoloader.rst b/user_guide_src/source/concepts/autoloader.rst index a285ab96de2a..5f30ce43865d 100644 --- a/user_guide_src/source/concepts/autoloader.rst +++ b/user_guide_src/source/concepts/autoloader.rst @@ -30,6 +30,12 @@ they work in sequence and don't get in each other's way. The autoloader is always active, being registered with ``spl_autoload_register()`` at the beginning of the framework's execution. +.. important:: You should always be careful about the case of filenames. Many + developers develop on case-insensitive file systems on Windows or macOS. + However, most server environments use case-sensitive file systems. If the + file name case is incorrect, the autoloader cannot find the file on the + server. + Configuration ************* diff --git a/user_guide_src/source/tutorial/static_pages.rst b/user_guide_src/source/tutorial/static_pages.rst index 26a25de7e661..c862b05be3ec 100644 --- a/user_guide_src/source/tutorial/static_pages.rst +++ b/user_guide_src/source/tutorial/static_pages.rst @@ -19,6 +19,12 @@ Let's Make our First Controller Create a file at **app/Controllers/Pages.php** with the following code. +.. important:: You should always be careful about the case of filenames. Many + developers develop on case-insensitive file systems on Windows or macOS. + However, most server environments use case-sensitive file systems. If the + file name case is incorrect, code that works locally will not work on the + server. + .. literalinclude:: static_pages/001.php You have created a class named ``Pages``, with a ``view()`` method that accepts From c35c30a2e1dfa560937505fee247da344e676d99 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 10:32:51 +0900 Subject: [PATCH 035/138] docs: add note for case-sensitive file systems in installation/running.rst --- user_guide_src/source/installation/running.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 4f24edd76950..97d0a052065b 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -9,6 +9,12 @@ A CodeIgniter 4 app can be run in a number of different ways: hosted on a web se using virtualization, or using CodeIgniter's command line tool for testing. This section addresses how to use each technique, and explains some of the pros and cons of them. +.. important:: You should always be careful about the case of filenames. Many + developers develop on case-insensitive file systems on Windows or macOS. + However, most server environments use case-sensitive file systems. If the + file name case is incorrect, code that works locally will not work on the + server. + If you're new to CodeIgniter, please read the :doc:`Getting Started ` section of the User Guide to begin learning how to build dynamic PHP applications. Enjoy! From 0d4c3717e1e3d81f53cb39725bc1d197d66fcb98 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 10:33:06 +0900 Subject: [PATCH 036/138] docs: add item in troubleshooting.rst --- .../source/installation/troubleshooting.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/user_guide_src/source/installation/troubleshooting.rst b/user_guide_src/source/installation/troubleshooting.rst index 30a8d0f55184..0d9685558670 100644 --- a/user_guide_src/source/installation/troubleshooting.rst +++ b/user_guide_src/source/installation/troubleshooting.rst @@ -56,6 +56,19 @@ If you see "No input file specified", try to change the rewrite rule like the fo RewriteRule ^([\s\S]*)$ index.php?/$1 [L,NC,QSA] +My app works fine locally but not on the production server +---------------------------------------------------------- + +Make sure that the case of the folder and file names matches the code. + +Many developers develop on case-insensitive file systems on Windows or macOS. +However, most server environments use case-sensitive file systems. + +For example, when you have **app/Controllers/Product.php**, you must use +``Product`` as the short classname, not ``product``. + +If the file name case is incorrect, the file is not found on the server. + The tutorial gives 404 errors everywhere :( ------------------------------------------- From 505bd2bcb00691a17c3f9e2408abe728d9406ee5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 11:24:12 +0900 Subject: [PATCH 037/138] docs: add note for URI::getSegment() --- user_guide_src/source/libraries/uri.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/user_guide_src/source/libraries/uri.rst b/user_guide_src/source/libraries/uri.rst index 43e77e0626e2..79ea65cbe66e 100644 --- a/user_guide_src/source/libraries/uri.rst +++ b/user_guide_src/source/libraries/uri.rst @@ -213,6 +213,10 @@ You can also set a different default value for a particular segment by using the .. literalinclude:: uri/024.php +.. note:: You can get the last +1 segment. When you try to get the last +2 or + more segment, an exception will be thrown by default. You could prevent + throwing exceptions with the ``setSilent()`` method. + You can get a count of the total segments: .. literalinclude:: uri/025.php From 1d4f677a347d61717aaab7c2403f3da982c061ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Feb 2023 15:15:16 +0000 Subject: [PATCH 038/138] chore(deps-dev): update rector/rector requirement Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.17...0.15.18) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 98fc97c5fc81..f8c44b8730f7 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "phpunit/phpcov": "^8.2", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1 || ^2.0", - "rector/rector": "0.15.17", + "rector/rector": "0.15.18", "vimeo/psalm": "^5.0" }, "suggest": { From b7ceda5f29c1c73665a1684acabb34c16a711e68 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 23 Feb 2023 01:13:36 +0700 Subject: [PATCH 039/138] temporary skip RemoveAlwaysTrueIfConditionRector as check truthy by @param doc --- rector.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rector.php b/rector.php index 797387ba4aba..10a3f9c226af 100644 --- a/rector.php +++ b/rector.php @@ -29,6 +29,7 @@ use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector; +use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector; use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector; use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector; use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector; @@ -114,6 +115,10 @@ GetMockBuilderGetMockToCreateMockRector::class => [ __DIR__ . '/tests/system/Email/EmailTest.php', ], + + // temporary skip as remove on variable check from @param doc + // ref https://github.com/rectorphp/rector-src/pull/3402 + RemoveAlwaysTrueIfConditionRector::class, ]); // auto import fully qualified class names From 85574fa7df0e78565285cd34133713720c9d2e55 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 23 Feb 2023 01:15:56 +0700 Subject: [PATCH 040/138] using @see --- rector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rector.php b/rector.php index 10a3f9c226af..a0a8bcd9fcae 100644 --- a/rector.php +++ b/rector.php @@ -117,7 +117,7 @@ ], // temporary skip as remove on variable check from @param doc - // ref https://github.com/rectorphp/rector-src/pull/3402 + // @see https://github.com/rectorphp/rector-src/pull/3402 RemoveAlwaysTrueIfConditionRector::class, ]); From 17e4b3de688ec55400436992c47ebd9e825f675b Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 23 Feb 2023 01:30:31 +0700 Subject: [PATCH 041/138] Add RawSql[] on @param on Basebuilder::updateFields() --- system/Database/BaseBuilder.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 653f43013f15..da7e329a50ff 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -2021,9 +2021,9 @@ private function setAlias(string $alias): BaseBuilder /** * Sets update fields for upsert, update * - * @param string|string[] $set - * @param bool $addToDefault adds update fields to the default ones - * @param array|null $ignore ignores items in set + * @param RawSql[]|string|string[] $set + * @param bool $addToDefault adds update fields to the default ones + * @param array|null $ignore ignores items in set * * @return $this */ From b9af2b8f6335ed9f8318598e94bc4ab7dc5b5cb3 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 13:09:16 +0900 Subject: [PATCH 042/138] test: remove setUp()/tearDown() CIUnitTestCase::setUp() calls Factories::reset(). --- tests/system/HTTP/URITest.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index 14de6e3d587b..0d4b5e3cdcf9 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -26,16 +26,6 @@ */ final class URITest extends CIUnitTestCase { - protected function setUp(): void - { - parent::setUp(); - } - - protected function tearDown(): void - { - Factories::reset('config'); - } - public function testConstructorSetsAllParts() { $uri = new URI('http://username:password@hostname:9090/path?arg=value#anchor'); From 09c19deabeb420bed7aedefef477a9d7ec910527 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 13:12:55 +0900 Subject: [PATCH 043/138] test: add empty lines --- tests/system/HTTP/URITest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index 0d4b5e3cdcf9..dea7f4a2df8d 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -60,6 +60,7 @@ public function testSegmentsIsPopulatedRightForMultipleSegments() public function testSegmentOutOfRange() { $this->expectException(HTTPException::class); + $uri = new URI('http://hostname/path/to/script'); $uri->getSegment(5); } @@ -68,12 +69,14 @@ public function testSegmentOutOfRangeWithSilent() { $url = 'http://abc.com/a123/b/c'; $uri = new URI($url); + $this->assertSame('', $uri->setSilent()->getSegment(22)); } public function testSegmentOutOfRangeWithDefaultValue() { $this->expectException(HTTPException::class); + $url = 'http://abc.com/a123/b/c'; $uri = new URI($url); $uri->getSegment(22, 'something'); @@ -83,6 +86,7 @@ public function testSegmentOutOfRangeWithSilentAndDefaultValue() { $url = 'http://abc.com/a123/b/c'; $uri = new URI($url); + $this->assertSame('something', $uri->setSilent()->getSegment(22, 'something')); } @@ -126,10 +130,12 @@ public function testSimpleUri() { $url = 'http://example.com'; $uri = new URI($url); + $this->assertSame($url, (string) $uri); $url = 'http://example.com/'; $uri = new URI($url); + $this->assertSame($url, (string) $uri); } @@ -140,12 +146,14 @@ public function testEmptyUri() $this->assertSame('http://' . $url, (string) $uri); $url = '/'; $uri = new URI($url); + $this->assertSame('http://', (string) $uri); } public function testMalformedUri() { $this->expectException(HTTPException::class); + $url = 'http://abc:a123'; new URI($url); } @@ -154,6 +162,7 @@ public function testMissingScheme() { $url = 'http://foo.bar/baz'; $uri = new URI($url); + $this->assertSame('http', $uri->getScheme()); $this->assertSame('foo.bar', $uri->getAuthority()); $this->assertSame('/baz', $uri->getPath()); @@ -165,6 +174,7 @@ public function testSchemeSub() $url = 'example.com'; $uri = new URI('http://' . $url); $uri->setScheme('x'); + $this->assertSame('x://' . $url, (string) $uri); } @@ -245,6 +255,7 @@ public function testSetPortInvalidValues() $this->expectException(HTTPException::class); $this->expectExceptionMessage(lang('HTTP.invalidPort', ['70000'])); + $uri->setPort(70000); } @@ -265,6 +276,7 @@ public function testSetPortTooSmall() $this->expectException(HTTPException::class); $this->expectExceptionMessage(lang('HTTP.invalidPort', [-1])); + $uri->setPort(-1); } @@ -275,12 +287,14 @@ public function testSetPortZero() $this->expectException(HTTPException::class); $this->expectExceptionMessage(lang('HTTP.invalidPort', [0])); + $uri->setPort(0); } public function testCatchesBadPort() { $this->expectException(HTTPException::class); + $url = 'http://username:password@hostname:90909/path?arg=value#anchor'; $uri = new URI(); $uri->setURI($url); @@ -407,6 +421,7 @@ public function testSetQueryThrowsErrorWhenFragmentPresent() $uri = new URI($url); $this->expectException(HTTPException::class); + $uri->setQuery('?key=value#fragment'); } @@ -936,6 +951,7 @@ public function testZeroAsURIPath() { $url = 'http://example.com/0'; $uri = new URI($url); + $this->assertSame($url, (string) $uri); $this->assertSame('/0', $uri->getPath()); } @@ -944,6 +960,7 @@ public function testEmptyURIPath() { $url = 'http://example.com/'; $uri = new URI($url); + $this->assertSame([], $uri->getSegments()); $this->assertSame(0, $uri->getTotalSegments()); } @@ -963,6 +980,7 @@ public function testSetURISilent() { $url = ':'; $uri = new URI(); + $uri->setSilent()->setURI($url); $this->assertTrue(true); From 18c89c4e6ead7fc9c3470f87934442bf71ce72ef Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 13:15:05 +0900 Subject: [PATCH 044/138] test: break long lines --- tests/system/HTTP/URITest.php | 45 ++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index dea7f4a2df8d..f413e20d4327 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -798,9 +798,18 @@ public function testGetQueryWithStrings() */ public function testNoExtraSlashes() { - $this->assertSame('http://entirely.different.com/subfolder', (string) (new URI('entirely.different.com/subfolder'))); - $this->assertSame('http://localhost/subfolder', (string) (new URI('localhost/subfolder'))); - $this->assertSame('http://localtest.me/subfolder', (string) (new URI('localtest.me/subfolder'))); + $this->assertSame( + 'http://entirely.different.com/subfolder', + (string) (new URI('entirely.different.com/subfolder')) + ); + $this->assertSame( + 'http://localhost/subfolder', + (string) (new URI('localhost/subfolder')) + ); + $this->assertSame( + 'http://localtest.me/subfolder', + (string) (new URI('localtest.me/subfolder')) + ); } public function testSetSegment() @@ -880,7 +889,10 @@ public function testBasedNoIndex() Services::injectMock('request', $request); // going through request - $this->assertSame('http://example.com/ci/v4/controller/method', (string) $request->getUri()); + $this->assertSame( + 'http://example.com/ci/v4/controller/method', + (string) $request->getUri() + ); $this->assertSame('ci/v4/controller/method', $request->getUri()->getPath()); // standalone @@ -907,12 +919,21 @@ public function testBasedWithIndex() Services::injectMock('request', $request); // going through request - $this->assertSame('http://example.com/ci/v4/index.php/controller/method', (string) $request->getUri()); - $this->assertSame('ci/v4/index.php/controller/method', $request->getUri()->getPath()); + $this->assertSame( + 'http://example.com/ci/v4/index.php/controller/method', + (string) $request->getUri() + ); + $this->assertSame( + 'ci/v4/index.php/controller/method', + $request->getUri()->getPath() + ); // standalone $uri = new URI('http://example.com/ci/v4/index.php/controller/method'); - $this->assertSame('http://example.com/ci/v4/index.php/controller/method', (string) $uri); + $this->assertSame( + 'http://example.com/ci/v4/index.php/controller/method', + (string) $uri + ); $this->assertSame('/ci/v4/index.php/controller/method', $uri->getPath()); $this->assertSame($uri->getPath(), '/' . $request->getUri()->getPath()); @@ -938,13 +959,19 @@ public function testForceGlobalSecureRequests() Services::injectMock('request', $request); // Detected by request - $this->assertSame('https://example.com/ci/v4/controller/method', (string) $request->getUri()); + $this->assertSame( + 'https://example.com/ci/v4/controller/method', + (string) $request->getUri() + ); // Standalone $uri = new URI('http://example.com/ci/v4/controller/method'); $this->assertSame('https://example.com/ci/v4/controller/method', (string) $uri); - $this->assertSame(trim($uri->getPath(), '/'), trim($request->getUri()->getPath(), '/')); + $this->assertSame( + trim($uri->getPath(), '/'), + trim($request->getUri()->getPath(), '/') + ); } public function testZeroAsURIPath() From 9966e5abd47c34567d17c1ff2ad5590712e504b9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 13:16:44 +0900 Subject: [PATCH 045/138] test: add empty lines --- tests/system/HTTP/URITest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index f413e20d4327..316985540a8a 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -352,6 +352,7 @@ public function testPathGetsFiltered($path, $expected) { $uri = new URI(); $uri->setPath($path); + $this->assertSame($expected, $uri->getPath()); } @@ -466,6 +467,7 @@ public function authorityInfo() public function testAuthorityReturnsExceptedValues($url, $expected) { $uri = new URI($url); + $this->assertSame($expected, $uri->getAuthority()); } From 9e46442dde6277341223b1fa42b0626d655052ff Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 13:21:47 +0900 Subject: [PATCH 046/138] test: remove empty lines --- tests/system/HTTP/URITest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index 316985540a8a..b9d32d83236f 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -122,7 +122,6 @@ public function testCanCastAsString() $uri = new URI($url); $expected = 'http://username@hostname:9090/path?arg=value#anchor'; - $this->assertSame($expected, (string) $uri); } @@ -497,7 +496,6 @@ public function testAuthorityRemovesDefaultPorts($scheme, $port) $uri = new URI($url); $expected = "{$scheme}://example.com/path"; - $this->assertSame($expected, (string) $uri); } From 695db91e0c948ad56c23c0fb400732bddfd92382 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 13:22:11 +0900 Subject: [PATCH 047/138] test: remove unneeded variable concatenation --- tests/system/HTTP/URITest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index b9d32d83236f..d2b8fea81586 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -142,7 +142,9 @@ public function testEmptyUri() { $url = ''; $uri = new URI($url); - $this->assertSame('http://' . $url, (string) $uri); + + $this->assertSame('http://', (string) $uri); + $url = '/'; $uri = new URI($url); From 859060bfed3eab6c0eb9ba28900fb9df7256cf17 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 13:24:36 +0900 Subject: [PATCH 048/138] test: move $expected lines --- tests/system/HTTP/URITest.php | 47 +++++++++++++++++------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index d2b8fea81586..8dceb6623593 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -184,10 +184,10 @@ public function testSetSchemeSetsValue() $url = 'http://example.com/path'; $uri = new URI($url); - $expected = 'https://example.com/path'; - $uri->setScheme('https'); + $this->assertSame('https', $uri->getScheme()); + $expected = 'https://example.com/path'; $this->assertSame($expected, (string) $uri); } @@ -196,10 +196,10 @@ public function testSetUserInfoSetsValue() $url = 'http://example.com/path'; $uri = new URI($url); - $expected = 'http://user@example.com/path'; - $uri->setUserInfo('user', 'password'); + $this->assertSame('user', $uri->getUserInfo()); + $expected = 'http://user@example.com/path'; $this->assertSame($expected, (string) $uri); } @@ -208,17 +208,16 @@ public function testUserInfoCanShowPassword() $url = 'http://example.com/path'; $uri = new URI($url); - $expected = 'http://user@example.com/path'; - $uri->setUserInfo('user', 'password'); + $this->assertSame('user', $uri->getUserInfo()); + $expected = 'http://user@example.com/path'; $this->assertSame($expected, (string) $uri); $uri->showPassword(); - $expected = 'http://user:password@example.com/path'; - $this->assertSame('user:password', $uri->getUserInfo()); + $expected = 'http://user:password@example.com/path'; $this->assertSame($expected, (string) $uri); } @@ -227,10 +226,10 @@ public function testSetHostSetsValue() $url = 'http://example.com/path'; $uri = new URI($url); - $expected = 'http://another.com/path'; - $uri->setHost('another.com'); + $this->assertSame('another.com', $uri->getHost()); + $expected = 'http://another.com/path'; $this->assertSame($expected, (string) $uri); } @@ -239,10 +238,10 @@ public function testSetPortSetsValue() $url = 'http://example.com/path'; $uri = new URI($url); - $expected = 'http://example.com:9000/path'; - $uri->setPort(9000); + $this->assertSame(9000, $uri->getPort()); + $expected = 'http://example.com:9000/path'; $this->assertSame($expected, (string) $uri); } @@ -306,10 +305,10 @@ public function testSetPathSetsValue() $url = 'http://example.com/path'; $uri = new URI($url); - $expected = 'http://example.com/somewhere/else'; - $uri->setPath('somewhere/else'); + $this->assertSame('somewhere/else', $uri->getPath()); + $expected = 'http://example.com/somewhere/else'; $this->assertSame($expected, (string) $uri); } @@ -362,10 +361,10 @@ public function testSetFragmentSetsValue() $url = 'http://example.com/path'; $uri = new URI($url); - $expected = 'http://example.com/path#good-stuff'; - $uri->setFragment('#good-stuff'); + $this->assertSame('good-stuff', $uri->getFragment()); + $expected = 'http://example.com/path#good-stuff'; $this->assertSame($expected, (string) $uri); } @@ -374,10 +373,10 @@ public function testSetQuerySetsValue() $url = 'http://example.com/path'; $uri = new URI($url); - $expected = 'http://example.com/path?key=value&second_key=value.2'; - $uri->setQuery('?key=value&second.key=value.2'); + $this->assertSame('key=value&second_key=value.2', $uri->getQuery()); + $expected = 'http://example.com/path?key=value&second_key=value.2'; $this->assertSame($expected, (string) $uri); } @@ -386,10 +385,10 @@ public function testSetQuerySetsValueWithUseRawQueryString() $url = 'http://example.com/path'; $uri = new URI($url); - $expected = 'http://example.com/path?key=value&second.key=value.2'; - $uri->useRawQueryString()->setQuery('?key=value&second.key=value.2'); + $this->assertSame('key=value&second.key=value.2', $uri->getQuery()); + $expected = 'http://example.com/path?key=value&second.key=value.2'; $this->assertSame($expected, (string) $uri); } @@ -398,10 +397,10 @@ public function testSetQueryArraySetsValue() $url = 'http://example.com/path'; $uri = new URI($url); - $expected = 'http://example.com/path?key=value&second_key=value.2'; - $uri->setQueryArray(['key' => 'value', 'second.key' => 'value.2']); + $this->assertSame('key=value&second_key=value.2', $uri->getQuery()); + $expected = 'http://example.com/path?key=value&second_key=value.2'; $this->assertSame($expected, (string) $uri); } @@ -410,10 +409,10 @@ public function testSetQueryArraySetsValueWithUseRawQueryString() $url = 'http://example.com/path'; $uri = new URI($url); - $expected = 'http://example.com/path?key=value&second.key=value.2'; - $uri->useRawQueryString()->setQueryArray(['key' => 'value', 'second.key' => 'value.2']); + $this->assertSame('key=value&second.key=value.2', $uri->getQuery()); + $expected = 'http://example.com/path?key=value&second.key=value.2'; $this->assertSame($expected, (string) $uri); } From 656af0a44a53bbbccb19737f6d304fbe4ea0d370 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 13:25:17 +0900 Subject: [PATCH 049/138] test: fix @param types --- tests/system/HTTP/URITest.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index 8dceb6623593..a72576879615 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -345,8 +345,8 @@ public function invalidPaths() /** * @dataProvider invalidPaths * - * @param mixed $path - * @param mixed $expected + * @param string $path + * @param string $expected */ public function testPathGetsFiltered($path, $expected) { @@ -461,8 +461,8 @@ public function authorityInfo() /** * @dataProvider authorityInfo * - * @param mixed $url - * @param mixed $expected + * @param string $url + * @param string $expected */ public function testAuthorityReturnsExceptedValues($url, $expected) { @@ -488,8 +488,8 @@ public function defaultPorts() /** * @dataProvider defaultPorts * - * @param mixed $scheme - * @param mixed $port + * @param string $scheme + * @param int $port */ public function testAuthorityRemovesDefaultPorts($scheme, $port) { @@ -611,8 +611,8 @@ public function defaultDots() /** * @dataProvider defaultDots * - * @param mixed $path - * @param mixed $expected + * @param string $path + * @param string $expected */ public function testRemoveDotSegments($path, $expected) { @@ -652,8 +652,8 @@ public function defaultResolutions() /** * @dataProvider defaultResolutions * - * @param mixed $rel - * @param mixed $expected + * @param string $rel + * @param string $expected */ public function testResolveRelativeURI($rel, $expected) { @@ -669,8 +669,8 @@ public function testResolveRelativeURI($rel, $expected) /** * @dataProvider defaultResolutions * - * @param mixed $rel - * @param mixed $expected + * @param string $rel + * @param string $expected */ public function testResolveRelativeURIHTTPS($rel, $expected) { From ab5393b801b5b03dcc095680c0bbaeda66ea0fa7 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 13:26:57 +0900 Subject: [PATCH 050/138] test: remove empty lines --- tests/system/HTTP/URITest.php | 39 ++++++++++++----------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index a72576879615..0a5f90f8b8e8 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -658,8 +658,7 @@ public function defaultResolutions() public function testResolveRelativeURI($rel, $expected) { $base = 'http://a/b/c/d'; - - $uri = new URI($base); + $uri = new URI($base); $new = $uri->resolveRelativeURI($rel); @@ -674,8 +673,7 @@ public function testResolveRelativeURI($rel, $expected) */ public function testResolveRelativeURIHTTPS($rel, $expected) { - $base = 'https://a/b/c/d'; - + $base = 'https://a/b/c/d'; $expected = str_replace('http:', 'https:', $expected); $uri = new URI($base); @@ -688,8 +686,7 @@ public function testResolveRelativeURIHTTPS($rel, $expected) public function testResolveRelativeURIWithNoBase() { $base = 'http://a'; - - $uri = new URI($base); + $uri = new URI($base); $new = $uri->resolveRelativeURI('x'); @@ -699,8 +696,7 @@ public function testResolveRelativeURIWithNoBase() public function testAddQueryVar() { $base = 'http://example.com/foo'; - - $uri = new URI($base); + $uri = new URI($base); $uri->addQuery('bar', 'baz'); @@ -712,8 +708,7 @@ public function testAddQueryVar() */ public function testSetQueryDecode() { - $base = 'http://example.com/foo'; - + $base = 'http://example.com/foo'; $uri = new URI($base); $encoded = urlencode('you+alice+to+the+little'); @@ -727,8 +722,7 @@ public function testSetQueryDecode() public function testAddQueryVarRespectsExistingQueryVars() { $base = 'http://example.com/foo?bar=baz'; - - $uri = new URI($base); + $uri = new URI($base); $uri->addQuery('baz', 'foz'); @@ -738,8 +732,7 @@ public function testAddQueryVarRespectsExistingQueryVars() public function testStripQueryVars() { $base = 'http://example.com/foo?foo=bar&bar=baz&baz=foz'; - - $uri = new URI($base); + $uri = new URI($base); $uri->stripQuery('bar', 'baz'); @@ -749,8 +742,7 @@ public function testStripQueryVars() public function testKeepQueryVars() { $base = 'http://example.com/foo?foo=bar&bar=baz&baz=foz'; - - $uri = new URI($base); + $uri = new URI($base); $uri->keepQuery('bar', 'baz'); @@ -769,8 +761,7 @@ public function testEmptyQueryVars() public function testGetQueryExcept() { $base = 'http://example.com/foo?foo=bar&bar=baz&baz=foz'; - - $uri = new URI($base); + $uri = new URI($base); $this->assertSame('foo=bar&baz=foz', $uri->getQuery(['except' => ['bar']])); } @@ -778,8 +769,7 @@ public function testGetQueryExcept() public function testGetQueryOnly() { $base = 'http://example.com/foo?foo=bar&bar=baz&baz=foz'; - - $uri = new URI($base); + $uri = new URI($base); $this->assertSame('bar=baz', $uri->getQuery(['only' => ['bar']])); $this->assertSame('foo=bar&baz=foz', $uri->getQuery(['except' => 'bar'])); @@ -788,8 +778,7 @@ public function testGetQueryOnly() public function testGetQueryWithStrings() { $base = 'http://example.com/foo?foo=bar&bar=baz&baz=foz'; - - $uri = new URI($base); + $uri = new URI($base); $this->assertSame('bar=baz', $uri->getQuery(['only' => 'bar'])); } @@ -862,10 +851,8 @@ public function testSetBadSegment() public function testSetBadSegmentSilent() { - $base = 'http://example.com/foo/bar/baz'; - - $uri = new URI($base); - + $base = 'http://example.com/foo/bar/baz'; + $uri = new URI($base); $segments = $uri->getSegments(); $uri->setSilent()->setSegment(6, 'banana'); From 1950d23e5bd2517c8a6a703702908b4a6f166ce7 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 13:28:04 +0900 Subject: [PATCH 051/138] test: add empty lines --- tests/system/HTTP/URITest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index 0a5f90f8b8e8..5406add500ff 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -755,6 +755,7 @@ public function testEmptyQueryVars() $uri = new URI($base); $uri->setQuery('foo=&bar=baz&baz=foz'); + $this->assertSame('http://example.com/foo?foo=&bar=baz&baz=foz', (string) $uri); } @@ -843,6 +844,7 @@ public function testSetSegmentFallback() public function testSetBadSegment() { $this->expectException(HTTPException::class); + $base = 'http://example.com/foo/bar/baz'; $uri = new URI($base); @@ -854,6 +856,7 @@ public function testSetBadSegmentSilent() $base = 'http://example.com/foo/bar/baz'; $uri = new URI($base); $segments = $uri->getSegments(); + $uri->setSilent()->setSegment(6, 'banana'); $this->assertSame($segments, $uri->getSegments()); From 7c8c7036e495e21dd986c4e505f7a4ca5bdfd4ae Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 13:29:35 +0900 Subject: [PATCH 052/138] test: move lines --- tests/system/HTTP/URITest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index 5406add500ff..884488f777aa 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -752,8 +752,8 @@ public function testKeepQueryVars() public function testEmptyQueryVars() { $base = 'http://example.com/foo'; + $uri = new URI($base); - $uri = new URI($base); $uri->setQuery('foo=&bar=baz&baz=foz'); $this->assertSame('http://example.com/foo?foo=&bar=baz&baz=foz', (string) $uri); @@ -806,8 +806,8 @@ public function testNoExtraSlashes() public function testSetSegment() { $base = 'http://example.com/foo/bar/baz'; + $uri = new URI($base); - $uri = new URI($base); $uri->setSegment(2, 'banana'); $this->assertSame('foo/banana/baz', $uri->getPath()); @@ -846,8 +846,8 @@ public function testSetBadSegment() $this->expectException(HTTPException::class); $base = 'http://example.com/foo/bar/baz'; + $uri = new URI($base); - $uri = new URI($base); $uri->setSegment(6, 'banana'); } From 36e13cad4bbb70c5fd8d76dbc01a9f09e19029e5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 13:33:14 +0900 Subject: [PATCH 053/138] test: add tests --- tests/system/HTTP/URITest.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index 884488f777aa..a83cb81a78c7 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -138,6 +138,32 @@ public function testSimpleUri() $this->assertSame($url, (string) $uri); } + public function testSimpleUriWithPath() + { + $url = 'http://example.com/one/two'; + $uri = new URI($url); + + $this->assertSame($url, (string) $uri); + + $url = 'http://example.com/one/two/'; + $uri = new URI($url); + + $this->assertSame($url, (string) $uri); + } + + public function testSimpleUriWithPathDoubleSlashes() + { + $url = 'http://example.com/one/two//'; + $uri = new URI($url); + + $this->assertSame('http://example.com/one/two/', (string) $uri); + + $url = 'http://example.com//one/two/'; + $uri = new URI($url); + + $this->assertSame('http://example.com/one/two/', (string) $uri); + } + public function testEmptyUri() { $url = ''; @@ -979,6 +1005,7 @@ public function testEmptyURIPath() $url = 'http://example.com/'; $uri = new URI($url); + $this->assertSame('/', $uri->getPath()); $this->assertSame([], $uri->getSegments()); $this->assertSame(0, $uri->getTotalSegments()); } From e14da58a465540557dd695f833cff7bd6ce4f3df Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Feb 2023 17:16:33 +0900 Subject: [PATCH 054/138] test: add assertions --- tests/system/HTTP/URITest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index a83cb81a78c7..2d4c0797f6bf 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -131,11 +131,13 @@ public function testSimpleUri() $uri = new URI($url); $this->assertSame($url, (string) $uri); + $this->assertSame('', $uri->getPath()); $url = 'http://example.com/'; $uri = new URI($url); $this->assertSame($url, (string) $uri); + $this->assertSame('/', $uri->getPath()); } public function testSimpleUriWithPath() @@ -144,11 +146,13 @@ public function testSimpleUriWithPath() $uri = new URI($url); $this->assertSame($url, (string) $uri); + $this->assertSame('/one/two', $uri->getPath()); $url = 'http://example.com/one/two/'; $uri = new URI($url); $this->assertSame($url, (string) $uri); + $this->assertSame('/one/two/', $uri->getPath()); } public function testSimpleUriWithPathDoubleSlashes() @@ -157,11 +161,13 @@ public function testSimpleUriWithPathDoubleSlashes() $uri = new URI($url); $this->assertSame('http://example.com/one/two/', (string) $uri); + $this->assertSame('/one/two/', $uri->getPath()); $url = 'http://example.com//one/two/'; $uri = new URI($url); $this->assertSame('http://example.com/one/two/', (string) $uri); + $this->assertSame('/one/two/', $uri->getPath()); } public function testEmptyUri() From 301176cc9f1a2e6c1cb94f4441f8ec4a1d43887a Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 23 Feb 2023 13:27:15 +0900 Subject: [PATCH 055/138] test: use dataProvider --- tests/system/HTTP/URITest.php | 161 ++++++++++++++++++++++++++-------- 1 file changed, 124 insertions(+), 37 deletions(-) diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index 2d4c0797f6bf..c9d6bb97f5d9 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -125,49 +125,66 @@ public function testCanCastAsString() $this->assertSame($expected, (string) $uri); } - public function testSimpleUri() - { - $url = 'http://example.com'; - $uri = new URI($url); - - $this->assertSame($url, (string) $uri); - $this->assertSame('', $uri->getPath()); - - $url = 'http://example.com/'; - $uri = new URI($url); - - $this->assertSame($url, (string) $uri); - $this->assertSame('/', $uri->getPath()); - } - - public function testSimpleUriWithPath() + /** + * @dataProvider provideURLs + */ + public function testSimpleUri(string $url, string $expectedURL, string $expectedPath) { - $url = 'http://example.com/one/two'; - $uri = new URI($url); - - $this->assertSame($url, (string) $uri); - $this->assertSame('/one/two', $uri->getPath()); - - $url = 'http://example.com/one/two/'; $uri = new URI($url); - $this->assertSame($url, (string) $uri); - $this->assertSame('/one/two/', $uri->getPath()); + $this->assertSame($expectedURL, (string) $uri); + $this->assertSame($expectedPath, $uri->getPath()); } - public function testSimpleUriWithPathDoubleSlashes() + public function provideURLs(): array { - $url = 'http://example.com/one/two//'; - $uri = new URI($url); - - $this->assertSame('http://example.com/one/two/', (string) $uri); - $this->assertSame('/one/two/', $uri->getPath()); - - $url = 'http://example.com//one/two/'; - $uri = new URI($url); - - $this->assertSame('http://example.com/one/two/', (string) $uri); - $this->assertSame('/one/two/', $uri->getPath()); + return [ + '' => [ + 'http://example.com', // url + 'http://example.com', // expectedURL + '', // expectedPath + ], + '/' => [ + 'http://example.com/', + 'http://example.com/', + '/', + ], + '/one/two' => [ + 'http://example.com/one/two', + 'http://example.com/one/two', + '/one/two', + ], + '/one/two/' => [ + 'http://example.com/one/two/', + 'http://example.com/one/two/', + '/one/two/', + ], + '/one/two//' => [ + 'http://example.com/one/two//', + 'http://example.com/one/two/', + '/one/two/', + ], + '//one/two//' => [ + 'http://example.com//one/two//', + 'http://example.com/one/two/', + '/one/two/', + ], + '//one//two//' => [ + 'http://example.com//one//two//', + 'http://example.com/one/two/', + '/one/two/', + ], + '///one/two' => [ + 'http://example.com///one/two', // url + 'http://example.com/one/two', // expectedURL + '/one/two', // expectedPath + ], + '/one/two///' => [ + 'http://example.com/one/two///', + 'http://example.com/one/two/', + '/one/two/', + ], + ]; } public function testEmptyUri() @@ -344,6 +361,76 @@ public function testSetPathSetsValue() $this->assertSame($expected, (string) $uri); } + /** + * @dataProvider providePaths + */ + public function testSetPath(string $path, string $expectedURL, string $expectedPath) + { + $url = 'http://example.com/'; + $uri = new URI($url); + + $uri->setPath($path); + + $this->assertSame($expectedURL, (string) $uri); + $this->assertSame($expectedPath, $uri->getPath()); + } + + public function providePaths(): array + { + return [ + '' => [ + '', // path + 'http://example.com', // expectedURL + '', // expectedPath + ], + '/' => [ + '/', + 'http://example.com/', + '/', + ], + '/one/two' => [ + '/one/two', + 'http://example.com/one/two', + '/one/two', + ], + '//one/two' => [ + '//one/two', + 'http://example.com/one/two', + '/one/two', + ], + '/one/two/' => [ + '/one/two/', + 'http://example.com/one/two/', + '/one/two/', + ], + '/one/two//' => [ + '/one/two//', + 'http://example.com/one/two/', + '/one/two/', + ], + '//one/two//' => [ + '//one/two//', + 'http://example.com/one/two/', + '/one/two/', + ], + '//one//two//' => [ + '//one//two//', + 'http://example.com/one/two/', + '/one/two/', + ], + '///one/two' => [ + '///one/two', + 'http://example.com/one/two', + '/one/two', + ], + '/one/two///' => [ + '/one/two///', // path + 'http://example.com/one/two/', // expectedURL + '/one/two/', // expectedPath + ], + ]; + } + public function invalidPaths() { return [ From b663775b32a84f602d83cdce6d35409b31c07923 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 9 Feb 2023 10:16:55 +0900 Subject: [PATCH 056/138] docs: add note for URI Segments --- user_guide_src/source/libraries/uri.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/uri.rst b/user_guide_src/source/libraries/uri.rst index 43e77e0626e2..aa0605cf269e 100644 --- a/user_guide_src/source/libraries/uri.rst +++ b/user_guide_src/source/libraries/uri.rst @@ -204,7 +204,13 @@ to an on-page anchor. Media URI's can make use of them in various other ways. URI Segments ============ -Each section of the path between the slashes is a single segment. The URI class provides a simple way to determine +Each section of the path between the slashes is a single segment. + +.. note:: URI Segments mean only the URI path part relative to the baseURL. If + your baseURL contains sub folders, the values will be different from the + current URI path. + +The URI class provides a simple way to determine what the values of the segments are. The segments start at 1 being the furthest left of the path. .. literalinclude:: uri/023.php From 3c485311c47fcffd38a250b5146c89b6bcb24c7e Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 23 Feb 2023 17:54:32 +0900 Subject: [PATCH 057/138] docs: improve description --- user_guide_src/source/libraries/uri.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/libraries/uri.rst b/user_guide_src/source/libraries/uri.rst index aa0605cf269e..f253c767f86b 100644 --- a/user_guide_src/source/libraries/uri.rst +++ b/user_guide_src/source/libraries/uri.rst @@ -206,9 +206,9 @@ URI Segments Each section of the path between the slashes is a single segment. -.. note:: URI Segments mean only the URI path part relative to the baseURL. If - your baseURL contains sub folders, the values will be different from the - current URI path. +.. note:: In the case of your site URI, URI Segments mean only the URI path part + relative to the baseURL. If your baseURL contains sub folders, the values + will be different from the current URI path. The URI class provides a simple way to determine what the values of the segments are. The segments start at 1 being the furthest left of the path. From 64cd54687ac27b345327e23af237dbbcb5786149 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 23 Feb 2023 19:02:51 +0900 Subject: [PATCH 058/138] docs: fix section title marks --- user_guide_src/source/incoming/restful.rst | 30 +++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/user_guide_src/source/incoming/restful.rst b/user_guide_src/source/incoming/restful.rst index 8fbefe0e1973..9240ac8b476d 100644 --- a/user_guide_src/source/incoming/restful.rst +++ b/user_guide_src/source/incoming/restful.rst @@ -1,5 +1,6 @@ +######################### RESTful Resource Handling -####################################################### +######################### .. contents:: :local: @@ -22,8 +23,9 @@ most "RESTful" your application would be considered. CodeIgniter makes it easy to create RESTful APIs for your resources, with its resource routes and `ResourceController`. +*************** Resource Routes -============================================================ +*************** You can quickly create a handful of RESTful routes for a single resource with the ``resource()`` method. This creates the five most common routes needed for full CRUD of a resource: create a new resource, update an existing one, @@ -43,7 +45,7 @@ generate update and delete methods that work with HTML forms: .. literalinclude:: restful/002.php Change the Controller Used --------------------------- +========================== You can specify the controller that should be used by passing in the ``controller`` option with the name of the controller that should be used: @@ -51,7 +53,7 @@ the controller that should be used: .. literalinclude:: restful/003.php Change the Placeholder Used ---------------------------- +=========================== By default, the ``(:segment)`` placeholder is used when a resource ID is needed. You can change this by passing in the ``placeholder`` option with the new string to use: @@ -59,7 +61,7 @@ in the ``placeholder`` option with the new string to use: .. literalinclude:: restful/004.php Limit the Routes Made ---------------------- +===================== You can restrict the routes generated with the ``only`` option. This should be **an array** or **comma separated list** of method names that should be created. Only routes that match one of these methods will be created. The rest will be ignored: @@ -72,8 +74,9 @@ Otherwise you can remove unused routes with the ``except`` option. This should a Valid methods are: ``index``, ``show``, ``create``, ``update``, ``new``, ``edit`` and ``delete``. +****************** ResourceController -============================================================ +****************** The ``ResourceController`` provides a convenient starting point for your RESTful API, with methods that correspond to the resource routes above. @@ -87,8 +90,9 @@ The routing for this would be: .. literalinclude:: restful/008.php +**************** Presenter Routes -============================================================ +**************** You can quickly create a presentation controller which aligns with a resource controller, using the ``presenter()`` method. This @@ -111,7 +115,7 @@ controller. You need to distinguish them, for instance: The second parameter accepts an array of options that can be used to modify the routes that are generated. Change the Controller Used --------------------------- +========================== You can specify the controller that should be used by passing in the ``controller`` option with the name of the controller that should be used: @@ -119,7 +123,7 @@ the controller that should be used: .. literalinclude:: restful/011.php Change the Placeholder Used ---------------------------- +=========================== By default, the ``(:segment)`` placeholder is used when a resource ID is needed. You can change this by passing in the ``placeholder`` option with the new string to use: @@ -127,7 +131,7 @@ in the ``placeholder`` option with the new string to use: .. literalinclude:: restful/012.php Limit the Routes Made ---------------------- +===================== You can restrict the routes generated with the ``only`` option. This should be **an array** or **comma separated list** of method names that should be created. Only routes that match one of these methods will be created. The rest will be ignored: @@ -140,8 +144,9 @@ Otherwise you can remove unused routes with the ``except`` option. This should a Valid methods are: ``index``, ``show``, ``new``, ``create``, ``edit``, ``update``, ``remove`` and ``delete``. +***************** ResourcePresenter -============================================================ +***************** The ``ResourcePresenter`` provides a convenient starting point for presenting views of your resource, and processing data from forms in those views, @@ -156,8 +161,9 @@ The routing for this would be: .. literalinclude:: restful/016.php +******************************* Presenter/Controller Comparison -============================================================= +******************************* This table presents a comparison of the default routes created by `resource()` and `presenter()` with their corresponding Controller functions. From 797b51ee8d2effe2ba23d524d0c38478dc80ad2a Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 24 Feb 2023 13:07:49 +0900 Subject: [PATCH 059/138] refactor: replace `Cache-control` with `Cache-Control` --- system/HTTP/DownloadResponse.php | 5 ++--- system/HTTP/ResponseTrait.php | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/system/HTTP/DownloadResponse.php b/system/HTTP/DownloadResponse.php index 899bec8583c6..d5824da1cabc 100644 --- a/system/HTTP/DownloadResponse.php +++ b/system/HTTP/DownloadResponse.php @@ -227,9 +227,8 @@ public function setContentType(string $mime, string $charset = 'UTF-8') */ public function noCache(): self { - $this->removeHeader('Cache-control'); - - $this->setHeader('Cache-control', ['private', 'no-transform', 'no-store', 'must-revalidate']); + $this->removeHeader('Cache-Control'); + $this->setHeader('Cache-Control', ['private', 'no-transform', 'no-store', 'must-revalidate']); return $this; } diff --git a/system/HTTP/ResponseTrait.php b/system/HTTP/ResponseTrait.php index 0ad3239e3cbd..dd490e90145d 100644 --- a/system/HTTP/ResponseTrait.php +++ b/system/HTTP/ResponseTrait.php @@ -345,8 +345,8 @@ protected function formatBody($body, string $format) */ public function noCache() { - $this->removeHeader('Cache-control'); - $this->setHeader('Cache-control', ['no-store', 'max-age=0', 'no-cache']); + $this->removeHeader('Cache-Control'); + $this->setHeader('Cache-Control', ['no-store', 'max-age=0', 'no-cache']); return $this; } @@ -399,7 +399,7 @@ public function setCache(array $options = []) unset($options['last-modified']); } - $this->setHeader('Cache-control', $options); + $this->setHeader('Cache-Control', $options); return $this; } From e90d56f5d7541e106adf0d1006feea12cebbc5ea Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 24 Feb 2023 13:08:25 +0900 Subject: [PATCH 060/138] docs: replace `Content-type` with `Content-Type` --- user_guide_src/source/concepts/http/002.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/concepts/http/002.php b/user_guide_src/source/concepts/http/002.php index 9a15a6d42d5e..20b58ca5f0b7 100644 --- a/user_guide_src/source/concepts/http/002.php +++ b/user_guide_src/source/concepts/http/002.php @@ -6,7 +6,7 @@ $response->setStatusCode(Response::HTTP_OK); $response->setBody($output); -$response->setHeader('Content-type', 'text/html'); +$response->setHeader('Content-Type', 'text/html'); $response->noCache(); // Sends the output to the browser From b3405c6ae9e343c9e088900e1e7eebdd297a33d6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 24 Feb 2023 13:13:40 +0900 Subject: [PATCH 061/138] docs: add section title marks --- user_guide_src/source/incoming/request.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/incoming/request.rst b/user_guide_src/source/incoming/request.rst index c68045d6aad2..3fb8079f7382 100644 --- a/user_guide_src/source/incoming/request.rst +++ b/user_guide_src/source/incoming/request.rst @@ -13,6 +13,7 @@ from the Request class to add specific functionality. In practice, you will need See the documentation for the :doc:`IncomingRequest Class ` and :doc:`CURLRequest Class ` for more usage details. +*************** Class Reference *************** From e68245147bd74e7c5b43a527c0adbf86d29a8a11 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 24 Feb 2023 13:15:40 +0900 Subject: [PATCH 062/138] docs: use relative paths --- user_guide_src/source/incoming/request.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/incoming/request.rst b/user_guide_src/source/incoming/request.rst index 3fb8079f7382..26b08425591a 100644 --- a/user_guide_src/source/incoming/request.rst +++ b/user_guide_src/source/incoming/request.rst @@ -10,8 +10,8 @@ This class provides the common functionality they both need, but both cases have custom classes that extend from the Request class to add specific functionality. In practice, you will need to use these classes. -See the documentation for the :doc:`IncomingRequest Class ` and -:doc:`CURLRequest Class ` for more usage details. +See the documentation for the :doc:`IncomingRequest Class <./incomingrequest>` and +:doc:`CURLRequest Class <../libraries/curlrequest>` for more usage details. *************** Class Reference @@ -96,7 +96,7 @@ Class Reference :rtype: mixed This method is identical to the ``getPost()``, ``getGet()`` and ``getCookie()`` methods from the - :doc:`IncomingRequest Class `, only it fetches server data (``$_SERVER``): + :doc:`IncomingRequest Class <./incomingrequest>`, only it fetches server data (``$_SERVER``): .. literalinclude:: request/004.php @@ -114,7 +114,7 @@ Class Reference :rtype: mixed This method is identical to the ``getPost()``, ``getGet()`` and ``getCookie()`` methods from the - :doc:`IncomingRequest Class `, only it fetches env data (``$_ENV``): + :doc:`IncomingRequest Class <./incomingrequest>`, only it fetches env data (``$_ENV``): .. literalinclude:: request/006.php From 983b0dadc3452411c64c1a1e8cc707ac94dc641e Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 24 Feb 2023 13:16:03 +0900 Subject: [PATCH 063/138] docs: decorate text --- user_guide_src/source/incoming/request.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/incoming/request.rst b/user_guide_src/source/incoming/request.rst index 26b08425591a..d15da89ec14e 100644 --- a/user_guide_src/source/incoming/request.rst +++ b/user_guide_src/source/incoming/request.rst @@ -24,11 +24,11 @@ Class Reference .. php:method:: getIPAddress() :returns: The user's IP Address, if it can be detected. If the IP address - is not a valid IP address, then will return 0.0.0.0. + is not a valid IP address, then will return ``0.0.0.0``. :rtype: string Returns the IP address for the current user. If the IP address is not valid, the method - will return '0.0.0.0': + will return ``0.0.0.0``: .. literalinclude:: request/001.php @@ -43,7 +43,7 @@ Class Reference .. important:: This method is deprecated. It will be removed in future releases. :param string $ip: IP address - :param string $which: IP protocol ('ipv4' or 'ipv6') + :param string $which: IP protocol (``ipv4`` or ``ipv6``) :returns: true if the address is valid, false if not :rtype: bool @@ -54,7 +54,7 @@ Class Reference .. literalinclude:: request/002.php - Accepts an optional second string parameter of 'ipv4' or 'ipv6' to specify + Accepts an optional second string parameter of ``ipv4`` or ``ipv6`` to specify an IP format. The default checks for both formats. .. php:method:: getMethod([$upper = false]) From fa4a0486ad1acf0786355c0d92ae9541769f368d Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 24 Feb 2023 13:22:11 +0900 Subject: [PATCH 064/138] test: update assertions --- tests/system/HTTP/CURLRequestDoNotShareOptionsTest.php | 4 ++-- tests/system/HTTP/CURLRequestTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system/HTTP/CURLRequestDoNotShareOptionsTest.php b/tests/system/HTTP/CURLRequestDoNotShareOptionsTest.php index f3540379dd6c..ad64e66af506 100644 --- a/tests/system/HTTP/CURLRequestDoNotShareOptionsTest.php +++ b/tests/system/HTTP/CURLRequestDoNotShareOptionsTest.php @@ -759,14 +759,14 @@ public function testSendContinuedWithManyHeaders() Set-Cookie: PHPSESSID=80pd3hlg38mvjnelpvokp9lad0; path=/ Content-Type: application/xml; charset=utf-8 Transfer-Encoding: chunked\x0d\x0a\x0d\x0aUpdate success! config"; - $request->setOutput($output); + $response = $request->get('answer'); $this->assertSame('Update success! config', $response->getBody()); $responseHeaderKeys = [ - 'Cache-control', + 'Cache-Control', 'Content-Type', 'Server', 'Connection', diff --git a/tests/system/HTTP/CURLRequestTest.php b/tests/system/HTTP/CURLRequestTest.php index 555bd4146d58..74e6f38e9325 100644 --- a/tests/system/HTTP/CURLRequestTest.php +++ b/tests/system/HTTP/CURLRequestTest.php @@ -742,14 +742,14 @@ public function testSendContinuedWithManyHeaders() Set-Cookie: PHPSESSID=80pd3hlg38mvjnelpvokp9lad0; path=/ Content-Type: application/xml; charset=utf-8 Transfer-Encoding: chunked\x0d\x0a\x0d\x0aUpdate success! config"; - $request->setOutput($output); + $response = $request->get('answer'); $this->assertSame('Update success! config', $response->getBody()); $responseHeaderKeys = [ - 'Cache-control', + 'Cache-Control', 'Content-Type', 'Server', 'Connection', From 4cc9259fbea9e61502da0f0194738aa7248773c1 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 27 Feb 2023 00:32:01 +0800 Subject: [PATCH 065/138] Fix handling of null bytes in `Exceptions::renderBacktrace()` --- system/Debug/Exceptions.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php index 6dc098d4af10..143d17ed56a3 100644 --- a/system/Debug/Exceptions.php +++ b/system/Debug/Exceptions.php @@ -531,9 +531,6 @@ private static function renderBacktrace(array $backtrace): string case is_resource($value): return sprintf('resource (%s)', get_resource_type($value)); - case is_string($value): - return var_export(clean_path($value), true); - default: return var_export($value, true); } From 788d346d4a9492edbf08a925722861eff7405c91 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 27 Feb 2023 00:56:26 +0800 Subject: [PATCH 066/138] fix: incorrect metadata querying of Redis cache --- system/Cache/Handlers/RedisHandler.php | 3 +-- tests/system/Cache/Handlers/AbstractHandlerTest.php | 2 +- tests/system/Cache/Handlers/RedisHandlerTest.php | 10 ++++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/system/Cache/Handlers/RedisHandler.php b/system/Cache/Handlers/RedisHandler.php index 8b3af5856319..6874a86c8f2c 100644 --- a/system/Cache/Handlers/RedisHandler.php +++ b/system/Cache/Handlers/RedisHandler.php @@ -233,12 +233,11 @@ public function getCacheInfo() */ public function getMetaData(string $key) { - $key = static::validateKey($key, $this->prefix); $value = $this->get($key); if ($value !== null) { $time = Time::now()->getTimestamp(); - $ttl = $this->redis->ttl($key); + $ttl = $this->redis->ttl(static::validateKey($key, $this->prefix)); return [ 'expire' => $ttl > 0 ? $time + $ttl : null, diff --git a/tests/system/Cache/Handlers/AbstractHandlerTest.php b/tests/system/Cache/Handlers/AbstractHandlerTest.php index 75e45218e215..e426e02eb3c5 100644 --- a/tests/system/Cache/Handlers/AbstractHandlerTest.php +++ b/tests/system/Cache/Handlers/AbstractHandlerTest.php @@ -19,7 +19,7 @@ */ abstract class AbstractHandlerTest extends CIUnitTestCase { - protected $handler; + protected BaseHandler $handler; protected static $key1 = 'key1'; protected static $key2 = 'key2'; protected static $key3 = 'key3'; diff --git a/tests/system/Cache/Handlers/RedisHandlerTest.php b/tests/system/Cache/Handlers/RedisHandlerTest.php index a31561336873..83a30a0de362 100644 --- a/tests/system/Cache/Handlers/RedisHandlerTest.php +++ b/tests/system/Cache/Handlers/RedisHandlerTest.php @@ -198,6 +198,16 @@ public function testGetCacheInfo() $this->assertIsArray($this->handler->getCacheInfo()); } + public function testGetMetadataNotNull(): void + { + $this->handler->save(self::$key1, 'value'); + + $metadata = $this->handler->getMetaData(self::$key1); + + $this->assertNotNull($metadata); + $this->assertIsArray($metadata); + } + public function testIsSupported() { $this->assertTrue($this->handler->isSupported()); From 1336c08f37a1ddf9efa6af805ff3285832823437 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 28 Feb 2023 11:40:08 +0900 Subject: [PATCH 067/138] docs: add note for CSP and Debug Toolbar --- user_guide_src/source/outgoing/response.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/user_guide_src/source/outgoing/response.rst b/user_guide_src/source/outgoing/response.rst index c3c10bc8d40d..0fcd5d45d7d5 100644 --- a/user_guide_src/source/outgoing/response.rst +++ b/user_guide_src/source/outgoing/response.rst @@ -140,6 +140,13 @@ visit the following sites: Turning CSP On -------------- +.. important:: The :ref:`Debug Toolbar ` may use Kint, which + outputs inline scripts. Therefore, when CSP is turned on, CSP nonce is + automatically output for the Debug Toolbar. However, if you are not using + CSP nonce, this will change the CSP header to something you do not intend, + and it will behave differently than in production; if you want to verify CSP + behavior, turn off the Debug Toolbar. + By default, support for this is off. To enable support in your application, edit the ``CSPEnabled`` value in **app/Config/App.php**: From 22807e013bfb3a7d9f1d7f26d86bab1f6553a175 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 15:56:52 +0000 Subject: [PATCH 068/138] chore(deps-dev): update rector/rector requirement Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.18...0.15.19) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f8c44b8730f7..13587f68d032 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "phpunit/phpcov": "^8.2", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1 || ^2.0", - "rector/rector": "0.15.18", + "rector/rector": "0.15.19", "vimeo/psalm": "^5.0" }, "suggest": { From da9045c7850fbf84df824ae7a779c635cd4f2fbe Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 28 Feb 2023 22:58:18 +0700 Subject: [PATCH 069/138] enable RemoveAlwaysTrueIfConditionRector --- rector.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rector.php b/rector.php index a0a8bcd9fcae..797387ba4aba 100644 --- a/rector.php +++ b/rector.php @@ -29,7 +29,6 @@ use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector; -use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector; use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector; use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector; use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector; @@ -115,10 +114,6 @@ GetMockBuilderGetMockToCreateMockRector::class => [ __DIR__ . '/tests/system/Email/EmailTest.php', ], - - // temporary skip as remove on variable check from @param doc - // @see https://github.com/rectorphp/rector-src/pull/3402 - RemoveAlwaysTrueIfConditionRector::class, ]); // auto import fully qualified class names From 98c4c0d0488885298a26f0875122e4b75f53fbdf Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 28 Feb 2023 23:08:25 +0700 Subject: [PATCH 070/138] skip fixture --- rector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/rector.php b/rector.php index 797387ba4aba..d79d47cb3fee 100644 --- a/rector.php +++ b/rector.php @@ -78,6 +78,7 @@ __DIR__ . '/system/Debug/Toolbar/Views/toolbar.tpl.php', __DIR__ . '/system/ThirdParty', __DIR__ . '/tests/system/Config/fixtures', + __DIR__ . '/tests/system/Filters/fixtures', __DIR__ . '/tests/_support', JsonThrowOnErrorRector::class, StringifyStrNeedlesRector::class, From f1f24074664951cb4c80a0f66e06bb3cc946c541 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 1 Mar 2023 15:07:49 +0900 Subject: [PATCH 071/138] fix: add missing TLS 1.3 support --- 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 488a5ee76f04..0136e7db1db6 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -1883,7 +1883,7 @@ protected function SMTPConnect() $crypto = stream_socket_enable_crypto( $this->SMTPConnect, true, - STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT + STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT ); if ($crypto !== true) { From ba868855d37a96820171c1bfb10f9c83061838a4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 1 Mar 2023 15:09:50 +0900 Subject: [PATCH 072/138] style: break long line --- system/Email/Email.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/system/Email/Email.php b/system/Email/Email.php index 0136e7db1db6..fe68ff2deda9 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -1883,7 +1883,10 @@ protected function SMTPConnect() $crypto = stream_socket_enable_crypto( $this->SMTPConnect, true, - STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT + STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT + | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT + | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT + | STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT ); if ($crypto !== true) { From 9c70a642d8c8355634a6169433c9dbed703ad8d4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 1 Mar 2023 15:20:28 +0900 Subject: [PATCH 073/138] docs: add changelog --- user_guide_src/source/changelogs/v4.3.3.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/user_guide_src/source/changelogs/v4.3.3.rst b/user_guide_src/source/changelogs/v4.3.3.rst index 6be500a3a589..6c796f8373e1 100644 --- a/user_guide_src/source/changelogs/v4.3.3.rst +++ b/user_guide_src/source/changelogs/v4.3.3.rst @@ -9,6 +9,11 @@ Release Date: Unreleased :local: :depth: 3 +SECURITY +******** + +- **Email:** Added missing TLS 1.3 support. + BREAKING ******** From a69ee43d2eb20289cecb352bcbe2ac45ea2e5d6a Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 1 Mar 2023 15:27:31 +0900 Subject: [PATCH 074/138] chore: update Kint to 5.0.4 --- admin/framework/composer.json | 2 +- composer.json | 2 +- system/ThirdParty/Kint/resources/compiled/solarized-dark.css | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/framework/composer.json b/admin/framework/composer.json index 2f3022a92b2b..905e123cd89a 100644 --- a/admin/framework/composer.json +++ b/admin/framework/composer.json @@ -13,7 +13,7 @@ "psr/log": "^1.1" }, "require-dev": { - "kint-php/kint": "^5.0.3", + "kint-php/kint": "^5.0.4", "codeigniter/coding-standard": "^1.5", "fakerphp/faker": "^1.9", "friendsofphp/php-cs-fixer": "3.13.0", diff --git a/composer.json b/composer.json index 13587f68d032..313dd11df23f 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "psr/log": "^1.1" }, "require-dev": { - "kint-php/kint": "^5.0.3", + "kint-php/kint": "^5.0.4", "codeigniter/coding-standard": "^1.5", "fakerphp/faker": "^1.9", "friendsofphp/php-cs-fixer": "3.13.0", diff --git a/system/ThirdParty/Kint/resources/compiled/solarized-dark.css b/system/ThirdParty/Kint/resources/compiled/solarized-dark.css index 1d3c28b0b80c..4ab5e287c54a 100644 --- a/system/ThirdParty/Kint/resources/compiled/solarized-dark.css +++ b/system/ThirdParty/Kint/resources/compiled/solarized-dark.css @@ -1 +1 @@ -.kint-rich{font-size:13px;overflow-x:auto;white-space:nowrap;background:#073642}.kint-rich.kint-folder{position:fixed;bottom:0;left:0;right:0;z-index:999999;width:100%;margin:0;display:block}.kint-rich.kint-folder dd.kint-foldout{max-height:calc(100vh - 100px);padding-right:10px;overflow-y:scroll;display:none}.kint-rich.kint-folder dd.kint-foldout.kint-show{display:block}.kint-rich::selection,.kint-rich::-moz-selection,.kint-rich::-webkit-selection{background:#268bd2;color:#839496}.kint-rich .kint-focused{box-shadow:0 0 3px 2px #2aa198}.kint-rich,.kint-rich::before,.kint-rich::after,.kint-rich *,.kint-rich *::before,.kint-rich *::after{box-sizing:border-box;border-radius:0;color:#839496;float:none !important;font-family:Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;line-height:15px;margin:0;padding:0;text-align:left}.kint-rich{margin:10px 0}.kint-rich dt,.kint-rich dl{width:auto}.kint-rich dt,.kint-rich div.access-path{background:#002b36;border:1px solid #586e75;color:#839496;display:block;font-weight:bold;list-style:none outside none;overflow:auto;padding:5px}.kint-rich dt:hover,.kint-rich div.access-path:hover{border-color:#268bd2}.kint-rich>dl dl{padding:0 0 0 15px}.kint-rich dt.kint-parent>nav,.kint-rich>footer>nav{background:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMzAgMTUwIj48ZGVmcz48cGF0aCBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkPSJNNCAzYTI0IDMyIDAgMCAxIDAgMjQgNDAgMjAtMTAgMCAxIDIzLTEyQTQwIDIwIDEwIDAgMSA0IDN6IiBpZD0iYSIvPjwvZGVmcz48ZyBmaWxsPSIjOTNhMWExIiBzdHJva2U9IiM5M2ExYTEiPjx1c2UgeGxpbms6aHJlZj0iI2EiLz48dXNlIHhsaW5rOmhyZWY9IiNhIiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAtMTUgNDUpIi8+PC9nPjxnIGZpbGw9IiM1ODZlNzUiIHN0cm9rZT0iIzU4NmU3NSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAzMCkiPjx1c2UgeGxpbms6aHJlZj0iI2EiLz48dXNlIHhsaW5rOmhyZWY9IiNhIiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAtMTUgNDUpIi8+PC9nPjxwYXRoIGQ9Ik02IDEyNmwxOCAxOG0tMTggMGwxOC0xOCIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2U9IiM1ODZlNzUiLz48L3N2Zz4=") no-repeat scroll 0 0/15px 75px transparent;cursor:pointer;display:inline-block;height:15px;width:15px;margin-right:3px;vertical-align:middle}.kint-rich dt.kint-parent:hover>nav,.kint-rich>footer>nav:hover{background-position:0 25%}.kint-rich dt.kint-parent.kint-show>nav,.kint-rich>footer.kint-show>nav{background-position:0 50%}.kint-rich dt.kint-parent.kint-show:hover>nav,.kint-rich>footer.kint-show>nav:hover{background-position:0 75%}.kint-rich dt.kint-parent.kint-locked>nav{background-position:0 100%}.kint-rich dt.kint-parent+dd{display:none;border-left:1px dashed #586e75}.kint-rich dt.kint-parent.kint-show+dd{display:block}.kint-rich var,.kint-rich var a{color:#268bd2;font-style:normal}.kint-rich dt:hover var,.kint-rich dt:hover var a{color:#2aa198}.kint-rich dfn{font-style:normal;font-family:monospace;color:#93a1a1}.kint-rich pre{color:#839496;margin:0 0 0 15px;padding:5px;overflow-y:hidden;border-top:0;border:1px solid #586e75;background:#002b36;display:block;word-break:normal}.kint-rich .kint-popup-trigger,.kint-rich .kint-access-path-trigger,.kint-rich .kint-search-trigger{background:rgba(131,148,150,0.8);border-radius:3px;height:16px;font-size:16px;margin-left:5px;font-weight:bold;width:16px;text-align:center;float:right !important;cursor:pointer;color:#002b36;position:relative;overflow:hidden;line-height:17.6px}.kint-rich .kint-popup-trigger:hover,.kint-rich .kint-access-path-trigger:hover,.kint-rich .kint-search-trigger:hover{color:#839496;background:#002b36}.kint-rich dt.kint-parent>.kint-popup-trigger{line-height:19.2px}.kint-rich .kint-search-trigger{font-size:20px}.kint-rich input.kint-search{display:none;border:1px solid #586e75;border-top-width:0;border-bottom-width:0;padding:5px;float:right !important;margin:-5px 0;color:#93a1a1;background:#073642;height:26px;width:160px;position:relative;z-index:100}.kint-rich input.kint-search.kint-show{display:block}.kint-rich .kint-search-root ul.kint-tabs>li:not(.kint-search-match){background:#252525;opacity:0.5}.kint-rich .kint-search-root dl:not(.kint-search-match){opacity:0.5}.kint-rich .kint-search-root dl:not(.kint-search-match)>dt{background:#1b1b1b}.kint-rich .kint-search-root dl:not(.kint-search-match) dl,.kint-rich .kint-search-root dl:not(.kint-search-match) ul.kint-tabs>li:not(.kint-search-match){opacity:1}.kint-rich div.access-path{background:#073642;display:none;margin-top:5px;padding:4px;white-space:pre}.kint-rich div.access-path.kint-show{display:block}.kint-rich footer{padding:0 3px 3px;font-size:9px;background:transparent}.kint-rich footer>.kint-popup-trigger{background:transparent;color:#839496}.kint-rich footer nav{height:10px;width:10px;background-size:10px 50px}.kint-rich footer>ol{display:none;margin-left:32px}.kint-rich footer.kint-show>ol{display:block}.kint-rich a{color:#839496;text-shadow:none;text-decoration:underline}.kint-rich a:hover{color:#93a1a1;border-bottom:1px dotted #93a1a1}.kint-rich ul{list-style:none;padding-left:15px}.kint-rich ul:not(.kint-tabs) li{border-left:1px dashed #586e75}.kint-rich ul:not(.kint-tabs) li>dl{border-left:none}.kint-rich ul.kint-tabs{margin:0 0 0 15px;padding-left:0;background:#002b36;border:1px solid #586e75;border-top:0}.kint-rich ul.kint-tabs>li{background:#073642;border:1px solid #586e75;cursor:pointer;display:inline-block;height:30px;margin:3px;padding:0 15px;vertical-align:top}.kint-rich ul.kint-tabs>li:hover,.kint-rich ul.kint-tabs>li.kint-active-tab:hover{border-color:#268bd2;color:#2aa198}.kint-rich ul.kint-tabs>li.kint-active-tab{background:#002b36;border-top:0;margin-top:-1px;height:27px;line-height:24px}.kint-rich ul.kint-tabs>li:not(.kint-active-tab){line-height:25px}.kint-rich ul.kint-tabs li+li{margin-left:0}.kint-rich ul.kint-tab-contents>li{display:none}.kint-rich ul.kint-tab-contents>li.kint-show{display:block}.kint-rich dt:hover+dd>ul>li.kint-active-tab{border-color:#268bd2;color:#2aa198}.kint-rich dt>.kint-color-preview{width:16px;height:16px;display:inline-block;vertical-align:middle;margin-left:10px;border:1px solid #586e75;background-color:#ccc;background-image:url('data:image/svg+xml;utf8,');background-size:100%}.kint-rich dt>.kint-color-preview:hover{border-color:#268bd2}.kint-rich dt>.kint-color-preview>div{width:100%;height:100%}.kint-rich table{border-collapse:collapse;empty-cells:show;border-spacing:0}.kint-rich table *{font-size:12px}.kint-rich table dt{background:none;padding:2.5px}.kint-rich table dt .kint-parent{min-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kint-rich table td,.kint-rich table th{border:1px solid #586e75;padding:2.5px;vertical-align:center}.kint-rich table th{cursor:alias}.kint-rich table td:first-child,.kint-rich table th{font-weight:bold;background:#073642;color:#93a1a1}.kint-rich table td{background:#002b36;white-space:pre}.kint-rich table td>dl{padding:0}.kint-rich table pre{border-top:0;border-right:0}.kint-rich table thead th:first-child{background:none;border:0}.kint-rich table tr:hover>td{box-shadow:0 0 1px 0 #268bd2 inset}.kint-rich table tr:hover var{color:#2aa198}.kint-rich table ul.kint-tabs li.kint-active-tab{height:20px;line-height:17px}.kint-rich pre.kint-source{margin-left:-1px}.kint-rich pre.kint-source[data-kint-filename]:before{display:block;content:attr(data-kint-filename);margin-bottom:5px;padding-bottom:5px;border-bottom:1px solid #073642}.kint-rich pre.kint-source>div:before{display:inline-block;content:counter(kint-l);counter-increment:kint-l;border-right:1px solid #268bd2;padding-right:10px;margin-right:10px}.kint-rich pre.kint-source>div.kint-highlight{background:#073642}.kint-rich .kint-microtime-lap{text-shadow:-1px 0 #268bd2,0 1px #268bd2,1px 0 #268bd2,0 -1px #268bd2;color:#002b36;font-weight:bold}input.kint-note-input{width:100%}body{background:#073642;color:#fff}.kint-rich{box-shadow:0 0 5px 3px #073642}.kint-rich .kint-focused{box-shadow:0 0 3px 2px #859900 inset;border-radius:7px}.kint-rich>dl>dt,.kint-rich ul.kint-tabs{box-shadow:4px 0 2px -3px #268bd2 inset}.kint-rich ul.kint-tabs li.kint-active-tab{padding-top:7px;height:34px}.kint-rich footer li{color:#ddd} +.kint-rich{font-size:13px;overflow-x:auto;white-space:nowrap;background:#073642}.kint-rich.kint-folder{position:fixed;bottom:0;left:0;right:0;z-index:999999;width:100%;margin:0;display:block}.kint-rich.kint-folder dd.kint-foldout{max-height:calc(100vh - 100px);padding-right:10px;overflow-y:scroll;display:none}.kint-rich.kint-folder dd.kint-foldout.kint-show{display:block}.kint-rich::selection,.kint-rich::-moz-selection,.kint-rich::-webkit-selection{background:#268bd2;color:#839496}.kint-rich .kint-focused{box-shadow:0 0 3px 2px #2aa198}.kint-rich,.kint-rich::before,.kint-rich::after,.kint-rich *,.kint-rich *::before,.kint-rich *::after{box-sizing:border-box;border-radius:0;color:#839496;float:none !important;font-family:Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;line-height:15px;margin:0;padding:0;text-align:left}.kint-rich{margin:10px 0}.kint-rich dt,.kint-rich dl{width:auto}.kint-rich dt,.kint-rich div.access-path{background:#002b36;border:1px solid #586e75;color:#839496;display:block;font-weight:bold;list-style:none outside none;overflow:auto;padding:5px}.kint-rich dt:hover,.kint-rich div.access-path:hover{border-color:#268bd2}.kint-rich>dl dl{padding:0 0 0 15px}.kint-rich dt.kint-parent>nav,.kint-rich>footer>nav{background:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMzAgMTUwIj48ZGVmcz48cGF0aCBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkPSJNNCAzYTI0IDMyIDAgMCAxIDAgMjQgNDAgMjAtMTAgMCAxIDIzLTEyQTQwIDIwIDEwIDAgMSA0IDN6IiBpZD0iYSIvPjwvZGVmcz48ZyBmaWxsPSIjOTNhMWExIiBzdHJva2U9IiM5M2ExYTEiPjx1c2UgeGxpbms6aHJlZj0iI2EiLz48dXNlIHhsaW5rOmhyZWY9IiNhIiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAtMTUgNDUpIi8+PC9nPjxnIGZpbGw9IiM1ODZlNzUiIHN0cm9rZT0iIzU4NmU3NSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAzMCkiPjx1c2UgeGxpbms6aHJlZj0iI2EiLz48dXNlIHhsaW5rOmhyZWY9IiNhIiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAtMTUgNDUpIi8+PC9nPjxwYXRoIGQ9Ik02IDEyNmwxOCAxOG0tMTggMGwxOC0xOCIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2U9IiM1ODZlNzUiLz48L3N2Zz4=") no-repeat scroll 0 0/15px 75px transparent;cursor:pointer;display:inline-block;height:15px;width:15px;margin-right:3px;vertical-align:middle}.kint-rich dt.kint-parent:hover>nav,.kint-rich>footer>nav:hover{background-position:0 25%}.kint-rich dt.kint-parent.kint-show>nav,.kint-rich>footer.kint-show>nav{background-position:0 50%}.kint-rich dt.kint-parent.kint-show:hover>nav,.kint-rich>footer.kint-show>nav:hover{background-position:0 75%}.kint-rich dt.kint-parent.kint-locked>nav{background-position:0 100%}.kint-rich dt.kint-parent+dd{display:none;border-left:1px dashed #586e75}.kint-rich dt.kint-parent.kint-show+dd{display:block}.kint-rich var,.kint-rich var a{color:#268bd2;font-style:normal}.kint-rich dt:hover var,.kint-rich dt:hover var a{color:#2aa198}.kint-rich dfn{font-style:normal;font-family:monospace;color:#93a1a1}.kint-rich pre{color:#839496;margin:0 0 0 15px;padding:5px;overflow-y:hidden;border-top:0;border:1px solid #586e75;background:#002b36;display:block;word-break:normal}.kint-rich .kint-popup-trigger,.kint-rich .kint-access-path-trigger,.kint-rich .kint-search-trigger{background:rgba(131,148,150,0.8);border-radius:3px;height:16px;font-size:16px;margin-left:5px;font-weight:bold;width:16px;text-align:center;float:right !important;cursor:pointer;color:#002b36;position:relative;overflow:hidden;line-height:17.6px}.kint-rich .kint-popup-trigger:hover,.kint-rich .kint-access-path-trigger:hover,.kint-rich .kint-search-trigger:hover{color:#839496;background:#002b36}.kint-rich dt.kint-parent>.kint-popup-trigger{line-height:19.2px}.kint-rich .kint-search-trigger{font-size:20px}.kint-rich input.kint-search{display:none;border:1px solid #586e75;border-top-width:0;border-bottom-width:0;padding:5px;float:right !important;margin:-5px 0;color:#93a1a1;background:#073642;height:26px;width:160px;position:relative;z-index:100}.kint-rich input.kint-search.kint-show{display:block}.kint-rich .kint-search-root ul.kint-tabs>li:not(.kint-search-match){background:#252525;opacity:0.5}.kint-rich .kint-search-root dl:not(.kint-search-match){opacity:0.5}.kint-rich .kint-search-root dl:not(.kint-search-match)>dt{background:#1b1b1b}.kint-rich .kint-search-root dl:not(.kint-search-match) dl,.kint-rich .kint-search-root dl:not(.kint-search-match) ul.kint-tabs>li:not(.kint-search-match){opacity:1}.kint-rich div.access-path{background:#073642;display:none;margin-top:5px;padding:4px;white-space:pre}.kint-rich div.access-path.kint-show{display:block}.kint-rich footer{padding:0 3px 3px;font-size:9px;background:transparent}.kint-rich footer>.kint-popup-trigger{background:transparent;color:#839496}.kint-rich footer nav{height:10px;width:10px;background-size:10px 50px}.kint-rich footer>ol{display:none;margin-left:32px}.kint-rich footer.kint-show>ol{display:block}.kint-rich a{color:#839496;text-shadow:none;text-decoration:underline}.kint-rich a:hover{color:#93a1a1;border-bottom:1px dotted #93a1a1}.kint-rich ul{list-style:none;padding-left:15px}.kint-rich ul:not(.kint-tabs) li{border-left:1px dashed #586e75}.kint-rich ul:not(.kint-tabs) li>dl{border-left:none}.kint-rich ul.kint-tabs{margin:0 0 0 15px;padding-left:0;background:#002b36;border:1px solid #586e75;border-top:0}.kint-rich ul.kint-tabs>li{background:#073642;border:1px solid #586e75;cursor:pointer;display:inline-block;height:30px;margin:3px;padding:0 15px;vertical-align:top}.kint-rich ul.kint-tabs>li:hover,.kint-rich ul.kint-tabs>li.kint-active-tab:hover{border-color:#268bd2;color:#2aa198}.kint-rich ul.kint-tabs>li.kint-active-tab{background:#002b36;border-top:0;margin-top:-1px;height:27px;line-height:24px}.kint-rich ul.kint-tabs>li:not(.kint-active-tab){line-height:25px}.kint-rich ul.kint-tabs li+li{margin-left:0}.kint-rich ul.kint-tab-contents>li{display:none}.kint-rich ul.kint-tab-contents>li.kint-show{display:block}.kint-rich dt:hover+dd>ul>li.kint-active-tab{border-color:#268bd2;color:#2aa198}.kint-rich dt>.kint-color-preview{width:16px;height:16px;display:inline-block;vertical-align:middle;margin-left:10px;border:1px solid #586e75;background-color:#ccc;background-image:url('data:image/svg+xml;utf8,');background-size:100%}.kint-rich dt>.kint-color-preview:hover{border-color:#268bd2}.kint-rich dt>.kint-color-preview>div{width:100%;height:100%}.kint-rich table{border-collapse:collapse;empty-cells:show;border-spacing:0}.kint-rich table *{font-size:12px}.kint-rich table dt{background:none;padding:2.5px}.kint-rich table dt .kint-parent{min-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kint-rich table td,.kint-rich table th{border:1px solid #586e75;padding:2.5px;vertical-align:center}.kint-rich table th{cursor:alias}.kint-rich table td:first-child,.kint-rich table th{font-weight:bold;background:#073642;color:#93a1a1}.kint-rich table td{background:#002b36;white-space:pre}.kint-rich table td>dl{padding:0}.kint-rich table pre{border-top:0;border-right:0}.kint-rich table thead th:first-child{background:none;border:0}.kint-rich table tr:hover>td{box-shadow:0 0 1px 0 #268bd2 inset}.kint-rich table tr:hover var{color:#2aa198}.kint-rich table ul.kint-tabs li.kint-active-tab{height:20px;line-height:17px}.kint-rich pre.kint-source{margin-left:-1px}.kint-rich pre.kint-source[data-kint-filename]:before{display:block;content:attr(data-kint-filename);margin-bottom:5px;padding-bottom:5px;border-bottom:1px solid #073642}.kint-rich pre.kint-source>div:before{display:inline-block;content:counter(kint-l);counter-increment:kint-l;border-right:1px solid #268bd2;padding-right:10px;margin-right:10px}.kint-rich pre.kint-source>div.kint-highlight{background:#073642}.kint-rich .kint-microtime-lap{text-shadow:-1px 0 #268bd2,0 1px #268bd2,1px 0 #268bd2,0 -1px #268bd2;color:#002b36;font-weight:bold}input.kint-note-input{width:100%}.kint-rich .kint-focused{box-shadow:0 0 3px 2px #859900 inset;border-radius:7px}.kint-rich>dl>dt,.kint-rich ul.kint-tabs{box-shadow:4px 0 2px -3px #268bd2 inset}.kint-rich ul.kint-tabs li.kint-active-tab{padding-top:7px;height:34px}.kint-rich footer li{color:#ddd} From ddc44af397865217b72e00dc7e9eef26c6614bed Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 1 Mar 2023 21:31:22 +0700 Subject: [PATCH 075/138] Fix @param null $arguments on FilterInterface --- system/Filters/FilterInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Filters/FilterInterface.php b/system/Filters/FilterInterface.php index 32a18de74682..8055d11e7949 100644 --- a/system/Filters/FilterInterface.php +++ b/system/Filters/FilterInterface.php @@ -29,7 +29,7 @@ interface FilterInterface * sent back to the client, allowing for error pages, * redirects, etc. * - * @param null $arguments + * @param array|null $arguments * * @return mixed */ @@ -41,7 +41,7 @@ public function before(RequestInterface $request, $arguments = null); * to stop execution of other after filters, short of * throwing an Exception or Error. * - * @param null $arguments + * @param array|null $arguments * * @return mixed */ From a6df5faf68206ec2be0a8b963af794c000c3f46a Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 2 Mar 2023 05:32:56 +0700 Subject: [PATCH 076/138] Fix @param null on RequestTrait --- system/HTTP/RequestTrait.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system/HTTP/RequestTrait.php b/system/HTTP/RequestTrait.php index 5dc0359b3488..1a326071dbe9 100644 --- a/system/HTTP/RequestTrait.php +++ b/system/HTTP/RequestTrait.php @@ -191,8 +191,8 @@ private function getClientIP(string $header): ?string * Fetch an item from the $_SERVER array. * * @param array|string|null $index Index for item to be fetched from $_SERVER - * @param int|null $filter A filter name to be applied - * @param null $flags + * @param int|string|null $filter A filter name to be applied + * @param array|int|null $flags * * @return mixed */ @@ -204,9 +204,9 @@ public function getServer($index = null, $filter = null, $flags = null) /** * Fetch an item from the $_ENV array. * - * @param null $index Index for item to be fetched from $_ENV - * @param null $filter A filter name to be applied - * @param null $flags + * @param string|null $index Index for item to be fetched from $_ENV + * @param int|string|null $filter A filter name to be applied + * @param array|int|null $flags * * @return mixed */ From 0ead60be3ec798a671e5d63d770054119db35f48 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 2 Mar 2023 12:30:15 +0700 Subject: [PATCH 077/138] use array|string|null on index, and int|null for filter --- system/HTTP/RequestTrait.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/HTTP/RequestTrait.php b/system/HTTP/RequestTrait.php index 1a326071dbe9..2392ecbc4a79 100644 --- a/system/HTTP/RequestTrait.php +++ b/system/HTTP/RequestTrait.php @@ -191,7 +191,7 @@ private function getClientIP(string $header): ?string * Fetch an item from the $_SERVER array. * * @param array|string|null $index Index for item to be fetched from $_SERVER - * @param int|string|null $filter A filter name to be applied + * @param int|null $filter A filter name to be applied * @param array|int|null $flags * * @return mixed @@ -204,9 +204,9 @@ public function getServer($index = null, $filter = null, $flags = null) /** * Fetch an item from the $_ENV array. * - * @param string|null $index Index for item to be fetched from $_ENV - * @param int|string|null $filter A filter name to be applied - * @param array|int|null $flags + * @param array|string|null $index Index for item to be fetched from $_ENV + * @param int|null $filter A filter name to be applied + * @param array|int|null $flags * * @return mixed */ From a64f99bd821ed07a9175881c1f624d4d7524b0ea Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 1 Mar 2023 21:45:39 +0700 Subject: [PATCH 078/138] Fix @param null on RequestInterface --- system/HTTP/RequestInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/HTTP/RequestInterface.php b/system/HTTP/RequestInterface.php index fd2cdfbbc949..cd30101eb9d2 100644 --- a/system/HTTP/RequestInterface.php +++ b/system/HTTP/RequestInterface.php @@ -40,8 +40,8 @@ public function isValidIP(string $ip, ?string $which = null): bool; * Fetch an item from the $_SERVER array. * Supplied by RequestTrait. * - * @param string $index Index for item to be fetched from $_SERVER - * @param null $filter A filter name to be applied + * @param string $index Index for item to be fetched from $_SERVER + * @param int|null $filter A filter name to be applied * * @return mixed */ From a6f146c96ad2159b1ae277ecab0b8c05a6a54b04 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 1 Mar 2023 21:50:37 +0700 Subject: [PATCH 079/138] allow int at @param filter --- system/HTTP/RequestInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/HTTP/RequestInterface.php b/system/HTTP/RequestInterface.php index cd30101eb9d2..155ca69bafd7 100644 --- a/system/HTTP/RequestInterface.php +++ b/system/HTTP/RequestInterface.php @@ -40,8 +40,8 @@ public function isValidIP(string $ip, ?string $which = null): bool; * Fetch an item from the $_SERVER array. * Supplied by RequestTrait. * - * @param string $index Index for item to be fetched from $_SERVER - * @param int|null $filter A filter name to be applied + * @param string $index Index for item to be fetched from $_SERVER + * @param int|string|null $filter A filter name to be applied * * @return mixed */ From 4b48e4e6657752ff78d763edfea960001c794025 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 2 Mar 2023 12:23:58 +0700 Subject: [PATCH 080/138] use array|string|null on index, and int|null for filter --- system/HTTP/RequestInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/HTTP/RequestInterface.php b/system/HTTP/RequestInterface.php index 155ca69bafd7..367c494928b8 100644 --- a/system/HTTP/RequestInterface.php +++ b/system/HTTP/RequestInterface.php @@ -40,8 +40,8 @@ public function isValidIP(string $ip, ?string $which = null): bool; * Fetch an item from the $_SERVER array. * Supplied by RequestTrait. * - * @param string $index Index for item to be fetched from $_SERVER - * @param int|string|null $filter A filter name to be applied + * @param array|string|null $index Index for item to be fetched from $_SERVER + * @param int|null $filter A filter name to be applied * * @return mixed */ From 2cbbda730b2946606db265ae95554d35902d2a9a Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 4 Mar 2023 21:14:47 +0900 Subject: [PATCH 081/138] docs: add warning --- user_guide_src/source/helpers/text_helper.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/user_guide_src/source/helpers/text_helper.rst b/user_guide_src/source/helpers/text_helper.rst index cb745b24c8b0..17c2358d330f 100755 --- a/user_guide_src/source/helpers/text_helper.rst +++ b/user_guide_src/source/helpers/text_helper.rst @@ -30,6 +30,10 @@ The following functions are available: Generates a random string based on the type and length you specify. Useful for creating passwords or generating random hashes. + .. warning:: Except for type **crypto**, no cryptographically secure + strings are generated. Therefore, it must not be used for cryptographic + purposes or purposes that requires return values to be unguessable. + The first parameter specifies the type of string, the second parameter specifies the length. The following choices are available: From 5df7def45f18444c3d15e20062ca99b32e58075c Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 6 Mar 2023 14:49:16 +0900 Subject: [PATCH 082/138] chore: remove php-cs-fixer Use coding-standard's dependency. --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 313dd11df23f..df93360432ad 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,6 @@ "kint-php/kint": "^5.0.4", "codeigniter/coding-standard": "^1.5", "fakerphp/faker": "^1.9", - "friendsofphp/php-cs-fixer": "3.13.0", "mikey179/vfsstream": "^1.6", "nexusphp/cs-config": "^3.6", "nexusphp/tachycardia": "^1.0", From 4f4a11092360ee9dfd027bebc9f19c5332ec92ce Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 6 Mar 2023 15:23:15 +0900 Subject: [PATCH 083/138] fix: use random_int() in random_string('numeric') --- system/Helpers/text_helper.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/system/Helpers/text_helper.php b/system/Helpers/text_helper.php index 51b2c7dbafa7..38b0a6bbde4b 100755 --- a/system/Helpers/text_helper.php +++ b/system/Helpers/text_helper.php @@ -543,7 +543,6 @@ function random_string(string $type = 'alnum', int $len = 8): string { switch ($type) { case 'alnum': - case 'numeric': case 'nozero': case 'alpha': switch ($type) { @@ -555,10 +554,6 @@ function random_string(string $type = 'alnum', int $len = 8): string $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; break; - case 'numeric': - $pool = '0123456789'; - break; - case 'nozero': $pool = '123456789'; break; @@ -566,6 +561,12 @@ function random_string(string $type = 'alnum', int $len = 8): string return substr(str_shuffle(str_repeat($pool, (int) ceil($len / strlen($pool)))), 0, $len); + case 'numeric': + $max = 10 ** $len - 1; + $rand = random_int(0, $max); + + return sprintf('%0' . $len . 'd', $rand); + case 'md5': return md5(uniqid((string) mt_rand(), true)); From 9ea7ce3e23cab573e854376e4db1a75e0ff83477 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 6 Mar 2023 15:25:16 +0900 Subject: [PATCH 084/138] docs: update docs --- user_guide_src/source/changelogs/v4.3.3.rst | 1 + user_guide_src/source/helpers/text_helper.rst | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/changelogs/v4.3.3.rst b/user_guide_src/source/changelogs/v4.3.3.rst index 6c796f8373e1..2cd881203e1a 100644 --- a/user_guide_src/source/changelogs/v4.3.3.rst +++ b/user_guide_src/source/changelogs/v4.3.3.rst @@ -13,6 +13,7 @@ SECURITY ******** - **Email:** Added missing TLS 1.3 support. +- **Text Helper:** The :php:func:`random_string()` type **numeric** is now cryptographically secure. BREAKING ******** diff --git a/user_guide_src/source/helpers/text_helper.rst b/user_guide_src/source/helpers/text_helper.rst index 17c2358d330f..9dc2346135aa 100755 --- a/user_guide_src/source/helpers/text_helper.rst +++ b/user_guide_src/source/helpers/text_helper.rst @@ -30,7 +30,7 @@ The following functions are available: Generates a random string based on the type and length you specify. Useful for creating passwords or generating random hashes. - .. warning:: Except for type **crypto**, no cryptographically secure + .. warning:: Except for type **numeric** and **crypto**, no cryptographically secure strings are generated. Therefore, it must not be used for cryptographic purposes or purposes that requires return values to be unguessable. @@ -49,6 +49,9 @@ The following functions are available: .. note:: When you use **crypto**, you must set an even number to the second parameter. Since v4.2.2, if you set an odd number, ``InvalidArgumentException`` will be thrown. + .. note:: Since v4.3.3, **numeric** uses ``random_int()``. In the previous + versions, it used ``str_shuffle()`` that is not cryptographically secure. + Usage example: .. literalinclude:: text_helper/002.php From 63d165e83c8ca8c73800a0e2134664cff9c6e39c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Mar 2023 15:56:47 +0000 Subject: [PATCH 085/138] chore(deps-dev): update rector/rector requirement Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.19...0.15.21) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index df93360432ad..beb77d7dc7b5 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "phpunit/phpcov": "^8.2", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1 || ^2.0", - "rector/rector": "0.15.19", + "rector/rector": "0.15.21", "vimeo/psalm": "^5.0" }, "suggest": { From 2a7f2f73ed91f92f5b022773bb69cc0534537d12 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 7 Mar 2023 09:10:30 +0900 Subject: [PATCH 086/138] fix: use first exception in exceptionHandler() --- system/Debug/Exceptions.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php index 143d17ed56a3..531e95fd9808 100644 --- a/system/Debug/Exceptions.php +++ b/system/Debug/Exceptions.php @@ -119,6 +119,11 @@ public function exceptionHandler(Throwable $exception) [$statusCode, $exitCode] = $this->determineCodes($exception); + // Get the first exception. + while ($prevException = $exception->getPrevious()) { + $exception = $prevException; + } + if ($this->config->log === true && ! in_array($statusCode, $this->config->ignoreCodes, true)) { log_message('critical', "{message}\nin {exFile} on line {exLine}.\n{trace}", [ 'message' => $exception->getMessage(), From fc1870bac30b7e8f4b20f1cd41f1179247bdce91 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 7 Mar 2023 10:15:16 +0900 Subject: [PATCH 087/138] docs: add note for addColumn() and NULL --- user_guide_src/source/dbmgmt/forge.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/user_guide_src/source/dbmgmt/forge.rst b/user_guide_src/source/dbmgmt/forge.rst index e55867cc287b..bfb3bca9aea1 100644 --- a/user_guide_src/source/dbmgmt/forge.rst +++ b/user_guide_src/source/dbmgmt/forge.rst @@ -254,6 +254,9 @@ The ``addColumn()`` method is used to modify an existing table. It accepts the same field array as :ref:`Creating Tables `, and can be used to add additional fields. +.. note:: Unlike when creating a table, if ``null`` is not specified, the column + will be ``NULL``, not ``NOT NULL``. + .. literalinclude:: forge/022.php If you are using MySQL or CUBIRD, then you can take advantage of their From dfa98974562e26bb28ae1d2f01fac8b76685e0b8 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 7 Mar 2023 11:18:55 +0900 Subject: [PATCH 088/138] docs: fix section title marks --- user_guide_src/source/libraries/validation.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 7e1731de5f82..8bcd92644825 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -1,5 +1,6 @@ .. _validation: +########## Validation ########## @@ -10,6 +11,7 @@ helps minimize the amount of code you'll write. :local: :depth: 2 +******** Overview ******** @@ -42,6 +44,7 @@ messages, various control structures are usually placed within the form HTML. Form validation, while simple to create, is generally very messy and tedious to implement. +************************ Form Validation Tutorial ************************ @@ -197,6 +200,7 @@ Then add validation rules in the controller (**Form.php**): If you submit the form you should see the success page or the form with error messages. +********************* Config for Validation ********************* @@ -238,6 +242,7 @@ If you want to use traditional rules, you need to change the rule classes in **a .. literalinclude:: validation/003.php +******************* Loading the Library ******************* @@ -251,6 +256,7 @@ for including multiple Rulesets, and collections of rules that can be easily reu .. note:: You may never need to use this method, as both the :doc:`Controller ` and the :doc:`Model ` provide methods to make validation even easier. +************************ Setting Validation Rules ************************ @@ -311,6 +317,7 @@ data to be validated: is not HTML form post (``Content-Type: multipart/form-data``), or gets data from :ref:`$request->getVar() `. +*********************** Working with Validation *********************** @@ -426,6 +433,7 @@ So it will ignore the row in the database that has ``id=4`` when it verifies the This can also be used to create more dynamic rules at runtime, as long as you take care that any dynamic keys passed in don't conflict with your form data. +******************* Working With Errors ******************* @@ -532,6 +540,7 @@ When specifying a field with a wildcard, all errors matching the mask will be ch .. _validation-customizing-error-display: +************************* Customizing Error Display ************************* @@ -580,6 +589,7 @@ right after the name of the field the error should belong to:: showError('username', 'my_single') ?> +********************* Creating Custom Rules ********************* @@ -654,6 +664,7 @@ Or you can use the following parameters: .. literalinclude:: validation/041.php +*************** Available Rules *************** From e61a39fda76f979a42463a3354bc984a019d0500 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 7 Mar 2023 11:19:41 +0900 Subject: [PATCH 089/138] docs: replace With with with in title --- user_guide_src/source/libraries/validation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 8bcd92644825..9e2feb643cc5 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -434,7 +434,7 @@ This can also be used to create more dynamic rules at runtime, as long as you ta keys passed in don't conflict with your form data. ******************* -Working With Errors +Working with Errors ******************* The Validation library provides several methods to help you set error messages, provide From ef287b75c6733d558d2fbef5f1f8a69f2b96553e Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 7 Mar 2023 11:25:42 +0900 Subject: [PATCH 090/138] docs: make file paths bold For consistency. --- user_guide_src/source/libraries/validation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 9e2feb643cc5..d392b9723980 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -440,7 +440,7 @@ Working with Errors The Validation library provides several methods to help you set error messages, provide custom error messages, and retrieve one or more errors to display. -By default, error messages are derived from language strings in ``system/Language/en/Validation.php``, where +By default, error messages are derived from language strings in **system/Language/en/Validation.php**, where each rule has an entry. .. _validation-custom-errors: @@ -479,7 +479,7 @@ Translation Of Messages And Validation Labels ============================================= To use translated strings from language files, we can simply use the dot syntax. -Let's say we have a file with translations located here: ``app/Languages/en/Rules.php``. +Let's say we have a file with translations located here: **app/Languages/en/Rules.php**. We can simply use the language lines defined in this file, like this: .. literalinclude:: validation/025.php From 85e08c8a4859ddf7001175db6f9d57d7af62fa2e Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 7 Mar 2023 11:26:19 +0900 Subject: [PATCH 091/138] docs: fix file paths --- user_guide_src/source/libraries/validation.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index d392b9723980..585786343beb 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -571,7 +571,7 @@ error message. This is used with the ``showError()`` method where a field must b Configuration ============= -Once you have your views created, you need to let the Validation library know about them. Open ``Config/Validation.php``. +Once you have your views created, you need to let the Validation library know about them. Open **app/Config/Validation.php**. Inside, you'll find the ``$templates`` property where you can list as many custom views as you want, and provide an short alias they can be referenced by. If we were to add our example file from above, it would look something like: @@ -602,7 +602,7 @@ autoloader can find it. These files are called RuleSets. Adding a RuleSet ---------------- -To add a new RuleSet, edit **Config/Validation.php** and +To add a new RuleSet, edit **app/Config/Validation.php** and add the new file to the ``$ruleSets`` array: .. literalinclude:: validation/033.php @@ -618,7 +618,7 @@ a boolean true or false value signifying true if it passed the test or false if .. literalinclude:: validation/034.php -By default, the system will look within ``CodeIgniter\Language\en\Validation.php`` for the language strings used +By default, the system will look within **system/Language/en/Validation.php** for the language strings used within errors. In custom rules, you may provide error messages by accepting a ``&$error`` variable by reference in the second parameter: From a2f2deaa0eb4bc85c4f76b2e565b92fc311ac319 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 7 Mar 2023 11:51:12 +0900 Subject: [PATCH 092/138] docs: make uppercase letters in title lower --- user_guide_src/source/libraries/validation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 585786343beb..28fdc8b85324 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -475,7 +475,7 @@ at least 6 characters." .. note:: When using label-style error messages, if you pass the second parameter to ``setRules()``, it will be overwritten with the value of the first parameter. -Translation Of Messages And Validation Labels +Translation of Messages and Validation Labels ============================================= To use translated strings from language files, we can simply use the dot syntax. From 6f1db3c0f266a9a3646e335098ee5c4ade792905 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 7 Mar 2023 11:54:32 +0900 Subject: [PATCH 093/138] docs: add "Redirect and Validation Errors" --- user_guide_src/source/helpers/form_helper.rst | 2 +- .../source/libraries/validation.rst | 19 +++++++++++++++++++ .../source/libraries/validation/042.php | 6 ++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 user_guide_src/source/libraries/validation/042.php diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst index cb60013843cc..6bb94e319840 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -534,7 +534,7 @@ The following functions are available: that are stored in the session. To store the errors in the session, you need to use ``withInput()`` with :php:func:`redirect() `. The returned array is the same as ``Validation::getErrors()``. - See :ref:`Validation ` for details. + See :ref:`Validation ` for details. Example:: diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 28fdc8b85324..fc0b93709e47 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -538,6 +538,25 @@ When specifying a field with a wildcard, all errors matching the mask will be ch .. literalinclude:: validation/029.php +.. _validation-redirect-and-validation-errors: + +Redirect and Validation Errors +============================== + +PHP shares nothing between requests. So when you redirect if a validation fails, +there will be no validation errors in the redirected request because the validation +has run in the previous request. + +In that case, you need to use Form helper function :php:func:`validation_errors()`, +:php:func:`validation_list_errors()` and :php:func:`validation_show_error()`. +These functions check the validation errors that are stored in the session. + +To store the validation errors in the session, you need to use ``withInput()`` +with :php:func:`redirect() `: + +.. literalinclude:: validation/042.php + :lines: 2- + .. _validation-customizing-error-display: ************************* diff --git a/user_guide_src/source/libraries/validation/042.php b/user_guide_src/source/libraries/validation/042.php new file mode 100644 index 000000000000..057364b4fe7a --- /dev/null +++ b/user_guide_src/source/libraries/validation/042.php @@ -0,0 +1,6 @@ +validateData($data, $rules)) { + return redirect()->back()->withInput(); +} From bb7204d0d68d01832cefc4e171a39bdd23c3d39c Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 7 Mar 2023 13:59:34 +0900 Subject: [PATCH 094/138] fix: use random_byte() in random_string() alnum,nozero,alpha --- system/Helpers/text_helper.php | 65 +++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/system/Helpers/text_helper.php b/system/Helpers/text_helper.php index 38b0a6bbde4b..7b52fa347698 100755 --- a/system/Helpers/text_helper.php +++ b/system/Helpers/text_helper.php @@ -559,7 +559,7 @@ function random_string(string $type = 'alnum', int $len = 8): string break; } - return substr(str_shuffle(str_repeat($pool, (int) ceil($len / strlen($pool)))), 0, $len); + return _from_random($len, $pool); case 'numeric': $max = 10 ** $len - 1; @@ -587,6 +587,69 @@ function random_string(string $type = 'alnum', int $len = 8): string } } +if (! function_exists('_from_random')) { + /** + * The following function was derived from code of Symfony (v6.2.7 - 2023-02-28) + * https://github.com/symfony/symfony/blob/80cac46a31d4561804c17d101591a4f59e6db3a2/src/Symfony/Component/String/ByteString.php#L45 + * Code subject to the MIT license (https://github.com/symfony/symfony/blob/v6.2.7/LICENSE). + * Copyright (c) 2004-present Fabien Potencier + * + * The following method was derived from code of the Hack Standard Library (v4.40 - 2020-05-03) + * https://github.com/hhvm/hsl/blob/80a42c02f036f72a42f0415e80d6b847f4bf62d5/src/random/private.php#L16 + * Code subject to the MIT license (https://github.com/hhvm/hsl/blob/master/LICENSE). + * Copyright (c) 2004-2020, Facebook, Inc. (https://www.facebook.com/) + * + * @internal Outside the framework this should not be used directly. + */ + function _from_random(int $length, string $pool): string + { + if ($length <= 0) { + throw new InvalidArgumentException( + sprintf('A strictly positive length is expected, "%d" given.', $length) + ); + } + + $poolSize = \strlen($pool); + $bits = (int) ceil(log($poolSize, 2.0)); + if ($bits <= 0 || $bits > 56) { + throw new InvalidArgumentException( + 'The length of the alphabet must in the [2^1, 2^56] range.' + ); + } + + $string = ''; + + while ($length > 0) { + $urandomLength = (int) ceil(2 * $length * $bits / 8.0); + $data = random_bytes($urandomLength); + $unpackedData = 0; + $unpackedBits = 0; + + for ($i = 0; $i < $urandomLength && $length > 0; $i++) { + // Unpack 8 bits + $unpackedData = ($unpackedData << 8) | \ord($data[$i]); + $unpackedBits += 8; + + // While we have enough bits to select a character from the alphabet, keep + // consuming the random data + for (; $unpackedBits >= $bits && $length > 0; $unpackedBits -= $bits) { + $index = ($unpackedData & ((1 << $bits) - 1)); + $unpackedData >>= $bits; + // Unfortunately, the alphabet size is not necessarily a power of two. + // Worst case, it is 2^k + 1, which means we need (k+1) bits and we + // have around a 50% chance of missing as k gets larger + if ($index < $poolSize) { + $string .= $pool[$index]; + $length--; + } + } + } + } + + return $string; + } +} + if (! function_exists('increment_string')) { /** * Add's _1 to a string or increment the ending number to allow _2, _3, etc From 73d930e72ce20cb03bb07df310d9edce7067e2d1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 7 Mar 2023 14:08:32 +0900 Subject: [PATCH 095/138] docs: update docs --- user_guide_src/source/changelogs/v4.3.3.rst | 3 ++- user_guide_src/source/helpers/text_helper.rst | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/changelogs/v4.3.3.rst b/user_guide_src/source/changelogs/v4.3.3.rst index 2cd881203e1a..231f27c3aab1 100644 --- a/user_guide_src/source/changelogs/v4.3.3.rst +++ b/user_guide_src/source/changelogs/v4.3.3.rst @@ -13,7 +13,8 @@ SECURITY ******** - **Email:** Added missing TLS 1.3 support. -- **Text Helper:** The :php:func:`random_string()` type **numeric** is now cryptographically secure. +- **Text Helper:** The :php:func:`random_string()` type **alpha**, **alnum**, + **numeric** and **nozero** are now cryptographically secure. BREAKING ******** diff --git a/user_guide_src/source/helpers/text_helper.rst b/user_guide_src/source/helpers/text_helper.rst index 9dc2346135aa..18ee0e7071a9 100755 --- a/user_guide_src/source/helpers/text_helper.rst +++ b/user_guide_src/source/helpers/text_helper.rst @@ -30,7 +30,8 @@ The following functions are available: Generates a random string based on the type and length you specify. Useful for creating passwords or generating random hashes. - .. warning:: Except for type **numeric** and **crypto**, no cryptographically secure + .. warning:: Except for type **alpha**, **alnum**, **numeric**, **nozero**, + and **crypto**, no cryptographically secure strings are generated. Therefore, it must not be used for cryptographic purposes or purposes that requires return values to be unguessable. @@ -49,8 +50,10 @@ The following functions are available: .. note:: When you use **crypto**, you must set an even number to the second parameter. Since v4.2.2, if you set an odd number, ``InvalidArgumentException`` will be thrown. - .. note:: Since v4.3.3, **numeric** uses ``random_int()``. In the previous - versions, it used ``str_shuffle()`` that is not cryptographically secure. + .. note:: Since v4.3.3, **alpha**, **alnum** and **nozero** use ``random_byte()``, + and **numeric** uses ``random_int()``. + In the previous versions, it used ``str_shuffle()`` that is not + cryptographically secure. Usage example: From 0d5a26f27dcdaa7e7c6f12d38ffe8a1d031c608f Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 Mar 2023 09:18:04 +0900 Subject: [PATCH 096/138] docs: fix out-of-dated description on App namespace --- user_guide_src/source/concepts/autoloader.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/concepts/autoloader.rst b/user_guide_src/source/concepts/autoloader.rst index 5f30ce43865d..e6553a96054f 100644 --- a/user_guide_src/source/concepts/autoloader.rst +++ b/user_guide_src/source/concepts/autoloader.rst @@ -60,8 +60,9 @@ have a trailing slash. > php spark namespaces -By default, the application folder is namespace to the ``App`` namespace. While you are not forced to namespace the controllers, -libraries, or models in the application directory, if you do, they will be found under the ``App`` namespace. +By default, the application folder is namespace to the ``App`` namespace. You must namespace the controllers, +libraries, or models in the application directory, and they will be found under the ``App`` namespace. + You may change this namespace by editing the **app/Config/Constants.php** file and setting the new namespace value under the ``APP_NAMESPACE`` setting: From 5ecf70dae521ca91a9d7fe7b4d7b740c8ae2db62 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 Mar 2023 09:19:02 +0900 Subject: [PATCH 097/138] docs: add missing $ --- user_guide_src/source/concepts/autoloader.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/concepts/autoloader.rst b/user_guide_src/source/concepts/autoloader.rst index e6553a96054f..3781367ce922 100644 --- a/user_guide_src/source/concepts/autoloader.rst +++ b/user_guide_src/source/concepts/autoloader.rst @@ -47,7 +47,7 @@ Namespaces The recommended method for organizing your classes is to create one or more namespaces for your application's files. This is most important for any business-logic related classes, entity classes, -etc. The ``psr4`` array in the configuration file allows you to map the namespace to the directory +etc. The ``$psr4`` array in the configuration file allows you to map the namespace to the directory those classes can be found in: .. literalinclude:: autoloader/001.php From e7fe68e5549b291b41d6def58fb77e58a2b1ed08 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 Mar 2023 09:51:32 +0900 Subject: [PATCH 098/138] docs: update sample code --- user_guide_src/source/concepts/autoloader.rst | 1 + .../source/concepts/autoloader/001.php | 18 ++++++++++++++---- .../source/concepts/autoloader/002.php | 2 +- .../source/concepts/autoloader/003.php | 16 +++++++++++++--- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/user_guide_src/source/concepts/autoloader.rst b/user_guide_src/source/concepts/autoloader.rst index 3781367ce922..06f02fad42af 100644 --- a/user_guide_src/source/concepts/autoloader.rst +++ b/user_guide_src/source/concepts/autoloader.rst @@ -67,6 +67,7 @@ You may change this namespace by editing the **app/Config/Constants.php** file a new namespace value under the ``APP_NAMESPACE`` setting: .. literalinclude:: autoloader/002.php + :lines: 2- You will need to modify any existing files that are referencing the current namespace. diff --git a/user_guide_src/source/concepts/autoloader/001.php b/user_guide_src/source/concepts/autoloader/001.php index 45ae094fbb3f..68eeaddd625f 100644 --- a/user_guide_src/source/concepts/autoloader/001.php +++ b/user_guide_src/source/concepts/autoloader/001.php @@ -1,6 +1,16 @@ APPPATH, - 'CodeIgniter' => SYSTEMPATH, -]; +namespace Config; + +use CodeIgniter\Config\AutoloadConfig; + +class Autoload extends AutoloadConfig +{ + // ... + public $psr4 = [ + APP_NAMESPACE => APPPATH, // For custom app namespace + 'Config' => APPPATH . 'Config', + ]; + + // ... +} diff --git a/user_guide_src/source/concepts/autoloader/002.php b/user_guide_src/source/concepts/autoloader/002.php index bf19e818c668..c2074c7c8d6f 100644 --- a/user_guide_src/source/concepts/autoloader/002.php +++ b/user_guide_src/source/concepts/autoloader/002.php @@ -1,3 +1,3 @@ APPPATH . 'third_party/markdown.php', -]; +namespace Config; + +use CodeIgniter\Config\AutoloadConfig; + +class Autoload extends AutoloadConfig +{ + // ... + public $classmap = [ + 'Markdown' => APPPATH . 'third_party/markdown.php', + ]; + + // ... +} From 4316498bc347deacbb7dda6303f88388645a9046 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 Mar 2023 10:04:03 +0900 Subject: [PATCH 099/138] docs: remove incorrect description `APPPATH . 'Config'` does not have a trailing back slash. --- user_guide_src/source/concepts/autoloader.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/user_guide_src/source/concepts/autoloader.rst b/user_guide_src/source/concepts/autoloader.rst index 06f02fad42af..689b8480ce2e 100644 --- a/user_guide_src/source/concepts/autoloader.rst +++ b/user_guide_src/source/concepts/autoloader.rst @@ -53,8 +53,7 @@ those classes can be found in: .. literalinclude:: autoloader/001.php The key of each row is the namespace itself. This does not need a trailing back slash. -The value is the location to the directory the classes can be found in. They should -have a trailing slash. +The value is the location to the directory the classes can be found in. .. note:: You can check the namespace configuration by ``spark namespaces`` command:: From fd95faf76ce7109d621e11597a2aa955840a267b Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 Mar 2023 17:08:14 +0900 Subject: [PATCH 100/138] docs: fix folder name Co-authored-by: Pooya Parsa Dadashi --- user_guide_src/source/concepts/autoloader/003.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/concepts/autoloader/003.php b/user_guide_src/source/concepts/autoloader/003.php index 48ce48f051f5..9cd0da4e6404 100644 --- a/user_guide_src/source/concepts/autoloader/003.php +++ b/user_guide_src/source/concepts/autoloader/003.php @@ -8,7 +8,7 @@ class Autoload extends AutoloadConfig { // ... public $classmap = [ - 'Markdown' => APPPATH . 'third_party/markdown.php', + 'Markdown' => APPPATH . 'ThirdParty/markdown.php', ]; // ... From 80ea505d28d590fee553602e583ffe10f593da2d Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 Mar 2023 17:58:34 +0900 Subject: [PATCH 101/138] docs: change to enumerate cryptographically insecure types --- user_guide_src/source/helpers/text_helper.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/helpers/text_helper.rst b/user_guide_src/source/helpers/text_helper.rst index 18ee0e7071a9..cb230d10b31d 100755 --- a/user_guide_src/source/helpers/text_helper.rst +++ b/user_guide_src/source/helpers/text_helper.rst @@ -30,10 +30,9 @@ The following functions are available: Generates a random string based on the type and length you specify. Useful for creating passwords or generating random hashes. - .. warning:: Except for type **alpha**, **alnum**, **numeric**, **nozero**, - and **crypto**, no cryptographically secure - strings are generated. Therefore, it must not be used for cryptographic - purposes or purposes that requires return values to be unguessable. + .. warning:: For types: **basic**, **md5**, and **sha1**, generated strings + are not cryptographically secure. Therefore, these types cannot be used + for cryptographic purposes or purposes requiring unguessable return values. The first parameter specifies the type of string, the second parameter specifies the length. The following choices are available: From 9ed490051cbd4fc9fabfec93932d4b4bfc610070 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 Mar 2023 21:00:29 +0900 Subject: [PATCH 102/138] docs: replace folder with directory For consistency. --- user_guide_src/source/concepts/autoloader.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/concepts/autoloader.rst b/user_guide_src/source/concepts/autoloader.rst index 689b8480ce2e..f6d38c75b293 100644 --- a/user_guide_src/source/concepts/autoloader.rst +++ b/user_guide_src/source/concepts/autoloader.rst @@ -59,7 +59,7 @@ The value is the location to the directory the classes can be found in. > php spark namespaces -By default, the application folder is namespace to the ``App`` namespace. You must namespace the controllers, +By default, the application directory is namespace to the ``App`` namespace. You must namespace the controllers, libraries, or models in the application directory, and they will be found under the ``App`` namespace. You may change this namespace by editing the **app/Config/Constants.php** file and setting the From 54186a97a2fcb41e27524df68b9d83730aa103d8 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 12 Mar 2023 10:25:39 +0900 Subject: [PATCH 103/138] fix: remove incorrect description We cannot specify negative number as an option value on CLI. --- system/Commands/Database/MigrateRollback.php | 2 +- user_guide_src/source/dbmgmt/migration.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Commands/Database/MigrateRollback.php b/system/Commands/Database/MigrateRollback.php index 17434da4b56d..c29ce84be443 100644 --- a/system/Commands/Database/MigrateRollback.php +++ b/system/Commands/Database/MigrateRollback.php @@ -57,7 +57,7 @@ class MigrateRollback extends BaseCommand * @var array */ protected $options = [ - '-b' => 'Specify a batch to roll back to; e.g. "3" to return to batch #3 or "-2" to roll back twice', + '-b' => 'Specify a batch to roll back to; e.g. "3" to return to batch #3', '-g' => 'Set database group', '-f' => 'Force command - this option allows you to bypass the confirmation question when running this command in a production environment', ]; diff --git a/user_guide_src/source/dbmgmt/migration.rst b/user_guide_src/source/dbmgmt/migration.rst index bf43be4b6199..f38cdaea5dd7 100644 --- a/user_guide_src/source/dbmgmt/migration.rst +++ b/user_guide_src/source/dbmgmt/migration.rst @@ -144,7 +144,7 @@ Rolls back all migrations, taking the database group to a blank slate, effective You can use (rollback) with the following options: - ``-g`` - to choose database group, otherwise default database group will be used. -- ``-b`` - to choose a batch: natural numbers specify the batch, negatives indicate a relative batch +- ``-b`` - to choose a batch: natural numbers specify the batch. - ``-f`` - to force a bypass confirmation question, it is only asked in a production environment refresh From a152ea74fab95b2a26f67ab5ab0ee92141c04366 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 12 Mar 2023 10:27:16 +0900 Subject: [PATCH 104/138] docs: add missing period --- user_guide_src/source/dbmgmt/migration.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/dbmgmt/migration.rst b/user_guide_src/source/dbmgmt/migration.rst index f38cdaea5dd7..117cdaacd099 100644 --- a/user_guide_src/source/dbmgmt/migration.rst +++ b/user_guide_src/source/dbmgmt/migration.rst @@ -124,7 +124,7 @@ You can use (migrate) with the following options: - ``-g`` - to chose database group, otherwise default database group will be used. - ``-n`` - to choose namespace, otherwise (App) namespace will be used. -- ``--all`` - to migrate all namespaces to the latest migration +- ``--all`` - to migrate all namespaces to the latest migration. This example will migrate ``Acme\Blog`` namespace with any new migrations on the test database group:: @@ -145,7 +145,7 @@ You can use (rollback) with the following options: - ``-g`` - to choose database group, otherwise default database group will be used. - ``-b`` - to choose a batch: natural numbers specify the batch. -- ``-f`` - to force a bypass confirmation question, it is only asked in a production environment +- ``-f`` - to force a bypass confirmation question, it is only asked in a production environment. refresh ======= @@ -158,8 +158,8 @@ You can use (refresh) with the following options: - ``-g`` - to choose database group, otherwise default database group will be used. - ``-n`` - to choose namespace, otherwise (App) namespace will be used. -- ``--all`` - to refresh all namespaces -- ``-f`` - to force a bypass confirmation question, it is only asked in a production environment +- ``--all`` - to refresh all namespaces. +- ``-f`` - to force a bypass confirmation question, it is only asked in a production environment. status ====== From df9906c4c20428c32460538a6aa5fe189e0fedaa Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 13 Mar 2023 17:47:16 +0900 Subject: [PATCH 105/138] docs: fix title marks --- user_guide_src/source/incoming/methodspoofing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/incoming/methodspoofing.rst b/user_guide_src/source/incoming/methodspoofing.rst index f32dcad04769..a17264f0b21c 100644 --- a/user_guide_src/source/incoming/methodspoofing.rst +++ b/user_guide_src/source/incoming/methodspoofing.rst @@ -1,6 +1,6 @@ -==================== +#################### HTTP Method Spoofing -==================== +#################### When working with HTML forms you can only use GET or POST HTTP verbs. In most cases, this is just fine. However, to support REST-ful routing you need to support other, more correct, verbs, like DELETE or PUT. Since the browsers From 266cef168cc3a5db1d5421808e2dc9c659b7cc17 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 13 Mar 2023 17:47:35 +0900 Subject: [PATCH 106/138] docs: update HTML tag --- user_guide_src/source/incoming/methodspoofing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/incoming/methodspoofing.rst b/user_guide_src/source/incoming/methodspoofing.rst index a17264f0b21c..e5dad509de99 100644 --- a/user_guide_src/source/incoming/methodspoofing.rst +++ b/user_guide_src/source/incoming/methodspoofing.rst @@ -11,7 +11,7 @@ To spoof the method, a hidden input is added to the form with the name of ``_met that you want the request to be::
- +
This form is converted into a PUT request and is a true PUT request as far as the routing and the IncomingRequest From 96d81ca4826c729b7c1039d5fc9347ddbeb96fc4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 14 Mar 2023 10:39:08 +0900 Subject: [PATCH 107/138] fix: add support protocol-relative links CI3 supports protocol-relative links --- system/Helpers/url_helper.php | 9 ++++++++- tests/system/Helpers/URLHelper/SiteUrlTest.php | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/system/Helpers/url_helper.php b/system/Helpers/url_helper.php index 1a064a76175f..8443c7a02980 100644 --- a/system/Helpers/url_helper.php +++ b/system/Helpers/url_helper.php @@ -117,13 +117,20 @@ function site_url($relativePath = '', ?string $scheme = null, ?App $config = nul { $uri = _get_uri($relativePath, $config); - return URI::createURIString( + $uriString = URI::createURIString( $scheme ?? $uri->getScheme(), $uri->getAuthority(), $uri->getPath(), $uri->getQuery(), $uri->getFragment() ); + + // For protocol-relative links + if ($scheme === '') { + $uriString = '//' . $uriString; + } + + return $uriString; } } diff --git a/tests/system/Helpers/URLHelper/SiteUrlTest.php b/tests/system/Helpers/URLHelper/SiteUrlTest.php index e05a7093e3da..acc2643b75ab 100644 --- a/tests/system/Helpers/URLHelper/SiteUrlTest.php +++ b/tests/system/Helpers/URLHelper/SiteUrlTest.php @@ -304,7 +304,21 @@ public function configProvider() ]; } - // base_url + public function testSiteURLWithEmptyStringScheme() + { + $this->config->baseURL = 'http://example.com/'; + $this->config->indexPage = 'index.php'; + $this->config->forceGlobalSecureRequests = false; + + $this->assertSame( + '//example.com/index.php/test', + site_url('test', '', $this->config) + ); + $this->assertSame( + '//example.com/img/test.jpg', + base_url('img/test.jpg', '') + ); + } /** * These tests are only really relevant to show that base_url() From 5f6fb6e5fba117f651a74582c051411d46fd70dd Mon Sep 17 00:00:00 2001 From: Angga Ari Wijaya Date: Thu, 9 Mar 2023 14:36:57 +0700 Subject: [PATCH 108/138] fix: respondNoContent() returns Kint script in development mode --- system/API/ResponseTrait.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system/API/ResponseTrait.php b/system/API/ResponseTrait.php index 0b357f0a177b..9e8bad775f78 100644 --- a/system/API/ResponseTrait.php +++ b/system/API/ResponseTrait.php @@ -92,8 +92,10 @@ protected function respond($data = null, ?int $status = null, string $message = if ($data === null && $status === null) { $status = 404; $output = null; + $this->format($data); } elseif ($data === null && is_numeric($status)) { $output = null; + $this->format($data); } else { $status = empty($status) ? 200 : $status; $output = $this->format($data); From 8aa470dbd7f58652f3fee378e4df8637877cc41c Mon Sep 17 00:00:00 2001 From: Angga Ari Wijaya Date: Tue, 14 Mar 2023 11:45:17 +0700 Subject: [PATCH 109/138] test: check content type for respondNoContent to make sure Debugbar is not included --- tests/system/API/ResponseTraitTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/system/API/ResponseTraitTest.php b/tests/system/API/ResponseTraitTest.php index 0c060691b0b3..653cac115f21 100644 --- a/tests/system/API/ResponseTraitTest.php +++ b/tests/system/API/ResponseTraitTest.php @@ -331,6 +331,7 @@ public function testNoContent() $this->invoke($controller, 'respondNoContent', ['']); + $this->assertStringStartsWith('application/json', $this->response->getHeaderLine('Content-Type')); $this->assertSame('No Content', $this->response->getReason()); $this->assertSame(204, $this->response->getStatusCode()); } From 1afa9dadac7071cc58c8ae8412d77d9ae0dc8494 Mon Sep 17 00:00:00 2001 From: totoprayogo1916 Date: Tue, 14 Mar 2023 12:00:52 +0700 Subject: [PATCH 110/138] doc: change logo (svg) Signed-off-by: totoprayogo1916 --- user_guide_src/source/_static/ci-logo-text.png | Bin 6076 -> 0 bytes user_guide_src/source/_static/ci-logo-text.svg | 1 + user_guide_src/source/_static/ci-logo.png | Bin 10140 -> 0 bytes user_guide_src/source/conf.py | 2 +- 4 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 user_guide_src/source/_static/ci-logo-text.png create mode 100644 user_guide_src/source/_static/ci-logo-text.svg delete mode 100644 user_guide_src/source/_static/ci-logo.png diff --git a/user_guide_src/source/_static/ci-logo-text.png b/user_guide_src/source/_static/ci-logo-text.png deleted file mode 100644 index fee0d49bed3d52e5b3d2a9f59cb115045cfdc3d3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6076 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 diff --git a/user_guide_src/source/_static/ci-logo.png b/user_guide_src/source/_static/ci-logo.png deleted file mode 100644 index 932d94b7c8fe47f8a25e356ca46044662bb98c77..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10140 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 VwrJDq7aevKw++n=YV^Q~{|DH5u0H?( diff --git a/user_guide_src/source/conf.py b/user_guide_src/source/conf.py index 7f7aa87e7c59..936eff54be31 100644 --- a/user_guide_src/source/conf.py +++ b/user_guide_src/source/conf.py @@ -89,7 +89,7 @@ # The name of an image file (relative to this directory) to place at the top # of the sidebar. -html_logo = '_static/ci-logo-text.png' +html_logo = '_static/ci-logo-text.svg' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 From 9e75e205629a4780888bc13167d45216333c89a9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 17 Mar 2023 10:14:37 +0900 Subject: [PATCH 111/138] docs: change to bullet points --- user_guide_src/source/changelogs/v4.3.2.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/changelogs/v4.3.2.rst b/user_guide_src/source/changelogs/v4.3.2.rst index 939ee780bb29..d0fccca1ea72 100644 --- a/user_guide_src/source/changelogs/v4.3.2.rst +++ b/user_guide_src/source/changelogs/v4.3.2.rst @@ -18,10 +18,10 @@ Behavior Changes base_url() ---------- -Due to a bug, in previous versions :php:func:`base_url()` without argument returned baseURL -without a trailing slash (``/``) like ``http://localhost:8080``. Now it returns -baseURL with a trailing slash. This is the same behavior as ``base_url()`` in -CodeIgniter 3. +- Due to a bug, in previous versions :php:func:`base_url()` without argument + returned baseURL without a trailing slash (``/``) like ``http://localhost:8080``. +- Now it returns baseURL with a trailing slash. This is the same behavior as + ``base_url()`` in CodeIgniter 3. Changes ******* From 1896042d5c56375fbda8fc3e0bb28e0af1728ec9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 17 Mar 2023 10:16:03 +0900 Subject: [PATCH 112/138] docs: fix typo --- user_guide_src/source/installation/upgrade_432.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/upgrade_432.rst b/user_guide_src/source/installation/upgrade_432.rst index 0e8a818124d3..5149c797f9ef 100644 --- a/user_guide_src/source/installation/upgrade_432.rst +++ b/user_guide_src/source/installation/upgrade_432.rst @@ -18,7 +18,7 @@ Breaking Changes base_url() ========== -The :php:func:`base_url()` behavior has been fix. In previous versions, when you +The :php:func:`base_url()` behavior has been fixed. In previous versions, when you call ``base_url()`` **without argument**, it returned baseURL without a trailing slash (``/``). Now it returns baseURL with a trailing slash. For example: From a853148e002c8a36c9be4a2ab4d8aa967cec0d64 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 17 Mar 2023 10:17:48 +0900 Subject: [PATCH 113/138] docs: add missing breaking change in uri_string() --- CHANGELOG.md | 2 +- user_guide_src/source/changelogs/v4.3.2.rst | 11 ++++++++--- user_guide_src/source/changelogs/v4.3.3.rst | 3 +++ user_guide_src/source/helpers/url_helper.rst | 4 ++++ .../source/installation/upgrade_432.rst | 15 +++++++++++++++ 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9786833e1d2e..509652f7ea87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Breaking Changes * fix: base_url() removes trailing slash in baseURL by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7200 +* fix: remove parameter $relative in `uri_string()` by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7135 ### Fixed Bugs @@ -14,7 +15,6 @@ * fix: remove `All` from `Options All -Indexes` in .htaccess by @sba in https://github.com/codeigniter4/CodeIgniter4/pull/7093 * fix: bug on stuck content-type header in Feature Testing by @baycik in https://github.com/codeigniter4/CodeIgniter4/pull/7112 * fix: ordering `Validation` show error by call `setRule()` by @ddevsr in https://github.com/codeigniter4/CodeIgniter4/pull/7149 -* fix: remove parameter $relative in `uri_string()` by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7135 * fix: [QueryBuilder] where() generates incorrect SQL when using RawSql by @sclubricants in https://github.com/codeigniter4/CodeIgniter4/pull/7147 * fix: [QueryBuilder] RawSql passed to set() disappears without error by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7148 * fix: [Parser] local_currency causes "Passing null to parameter" by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7157 diff --git a/user_guide_src/source/changelogs/v4.3.2.rst b/user_guide_src/source/changelogs/v4.3.2.rst index d0fccca1ea72..03e90d199b43 100644 --- a/user_guide_src/source/changelogs/v4.3.2.rst +++ b/user_guide_src/source/changelogs/v4.3.2.rst @@ -23,11 +23,16 @@ base_url() - Now it returns baseURL with a trailing slash. This is the same behavior as ``base_url()`` in CodeIgniter 3. -Changes -******* +.. _v432-uri-string: + +uri_string() +------------ - The parameter ``$relative`` in :php:func:`uri_string()` was removed. Due to a bug, - the function always returned a path relative to baseURL. No behavior changes. + the function always returned a path relative to baseURL. +- When baseURL is accessed, it will now return an empty string (``''``). This is + the same behavior as ``uri_string()`` in CodeIgniter 3. In previous versions + it returned ``/``. Bugs Fixed ********** diff --git a/user_guide_src/source/changelogs/v4.3.3.rst b/user_guide_src/source/changelogs/v4.3.3.rst index 2cd881203e1a..396e98027077 100644 --- a/user_guide_src/source/changelogs/v4.3.3.rst +++ b/user_guide_src/source/changelogs/v4.3.3.rst @@ -32,6 +32,9 @@ Bugs Fixed - **Config:** Added missing ``Config\Encryption::$cipher``. - **UserGuide:** Fixed the sample code for :ref:`encryption-compatible-with-ci3`. +- **UserGuide:** Added a missing breaking change in ``uri_string()`` in + :ref:`ChangeLog ` and + :ref:`Upgrading Guide ` v4.3.2. See the repo's `CHANGELOG.md `_ diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst index 8e2b32ebfae3..eec0c7067d54 100644 --- a/user_guide_src/source/helpers/url_helper.rst +++ b/user_guide_src/source/helpers/url_helper.rst @@ -155,6 +155,10 @@ The following functions are available: However, due to a bug, this function always returned a path relative to baseURL. Since v4.3.2, the parameter has been removed. + .. note:: In previous versions, when you navigate to the baseURL, this function + returned ``/``. Since v4.3.2, the bug has been fixed and it returns an + empty string(``''``). + .. php:function:: index_page([$altConfig = null]) :param \\Config\\App $altConfig: Alternate configuration to use diff --git a/user_guide_src/source/installation/upgrade_432.rst b/user_guide_src/source/installation/upgrade_432.rst index 5149c797f9ef..c9e83843d678 100644 --- a/user_guide_src/source/installation/upgrade_432.rst +++ b/user_guide_src/source/installation/upgrade_432.rst @@ -27,6 +27,21 @@ slash (``/``). Now it returns baseURL with a trailing slash. For example: If you have code to call ``base_url()`` without argument, you may need to adjust the URLs. +.. _upgrade-432-uri-string: + +uri_string() +============ + +The :php:func:`uri_string()` behavior has been fixed. In previous versions, when you +navigate to the baseURL, it returned ``/``. Now it returns an empty string (``''``). + +If you have code to call ``uri_string()``, you may need to adjust it. + +.. note:: The :php:func:`uri_string()` returns a URI path relative to baseURL. + It is not a full URI path if the baseURL contains subfolders. + If you use it for HTML links, it is better to use it with :php:func:`site_url()` + like ``site_url(uri_string())``. + Mandatory File Changes ********************** From 533a0905d0af42647da10efd204c53476d659e84 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Mar 2023 10:05:56 +0900 Subject: [PATCH 114/138] chore: update Kint to 5.0.5 --- .../Kint/Zval/Representation/SplFileInfoRepresentation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php b/system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php index 44980d7e359a..6424ee6a9175 100644 --- a/system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php +++ b/system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php @@ -57,7 +57,7 @@ public function __construct(SplFileInfo $fileInfo) $this->path = $fileInfo->getPathname(); try { - if ($fileInfo->getRealPath()) { + if (\strlen($this->path) && $fileInfo->getRealPath()) { $this->perms = $fileInfo->getPerms(); $this->size = $fileInfo->getSize(); $this->owner = $fileInfo->getOwner(); From ba63308809eecf7c96fe0a762edb03ff998ce8f5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Mar 2023 11:16:01 +0900 Subject: [PATCH 115/138] docs: add section title marks --- user_guide_src/source/outgoing/view_renderer.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/user_guide_src/source/outgoing/view_renderer.rst b/user_guide_src/source/outgoing/view_renderer.rst index 6832ae84b816..1e0451d5358d 100644 --- a/user_guide_src/source/outgoing/view_renderer.rst +++ b/user_guide_src/source/outgoing/view_renderer.rst @@ -6,6 +6,7 @@ View Renderer :local: :depth: 2 +*********************** Using the View Renderer *********************** @@ -102,6 +103,7 @@ Several options can be passed to the ``render()`` or ``renderString()`` methods: .. note:: ``saveData`` as defined by the interface must be a boolean, but implementing classes (like ``View`` below) may extend this to include ``null`` values. +*************** Class Reference *************** From 2b530fec7d1fd686f9cf0df71c82ff609c027b73 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Mar 2023 11:16:34 +0900 Subject: [PATCH 116/138] docs: add "Setting View Parameters" section --- user_guide_src/source/outgoing/view_renderer.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/user_guide_src/source/outgoing/view_renderer.rst b/user_guide_src/source/outgoing/view_renderer.rst index 1e0451d5358d..94f29349bd51 100644 --- a/user_guide_src/source/outgoing/view_renderer.rst +++ b/user_guide_src/source/outgoing/view_renderer.rst @@ -46,6 +46,20 @@ script. You will have to give each escaped value a unique parameter name. No special meaning is attached to parameters whose value is an array. It is up to you to process the array appropriately in your PHP code. +Setting View Parameters +======================= + +The :php:meth:`setVar() ` method sets a view parameter. + +.. literalinclude:: view_renderer/008.php + :lines: 2- + +The :php:meth:`setData() ` method sets multiple view +parameters at once. + +.. literalinclude:: view_renderer/007.php + :lines: 2- + Method Chaining =============== From 8a3174dcde461492b440c5cf78a37d62ac96a7c7 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Mar 2023 11:17:46 +0900 Subject: [PATCH 117/138] docs: remove Date: Sat, 18 Mar 2023 11:18:17 +0900 Subject: [PATCH 118/138] docs: remove :noindex: --- user_guide_src/source/outgoing/view_renderer.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/user_guide_src/source/outgoing/view_renderer.rst b/user_guide_src/source/outgoing/view_renderer.rst index 99b115b48ac1..39d712826ed3 100644 --- a/user_guide_src/source/outgoing/view_renderer.rst +++ b/user_guide_src/source/outgoing/view_renderer.rst @@ -130,7 +130,6 @@ Class Reference .. php:class:: View .. php:method:: render($view[, $options[, $saveData = false]]) - :noindex: :param string $view: File name of the view source :param array $options: Array of options, as key/value pairs @@ -144,7 +143,6 @@ Class Reference :lines: 2- .. php:method:: renderString($view[, $options[, $saveData = false]]) - :noindex: :param string $view: Contents of the view to render, for instance content retrieved from a database :param array $options: Array of options, as key/value pairs @@ -163,7 +161,6 @@ Class Reference appropriately! .. php:method:: setData([$data[, $context = null]]) - :noindex: :param array $data: Array of view data strings, as key/value pairs :param string $context: The context to use for data escaping. @@ -182,7 +179,6 @@ Class Reference until the view is rendered. .. php:method:: setVar($name[, $value = null[, $context = null]]) - :noindex: :param string $name: Name of the view data variable :param mixed $value: The value of this view data From dc9a42444b5219b0635f053cd39e420d9ced43b9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Mar 2023 11:18:47 +0900 Subject: [PATCH 119/138] docs: make function name linkable --- user_guide_src/source/outgoing/view_renderer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/outgoing/view_renderer.rst b/user_guide_src/source/outgoing/view_renderer.rst index 39d712826ed3..d2e97e5d6a71 100644 --- a/user_guide_src/source/outgoing/view_renderer.rst +++ b/user_guide_src/source/outgoing/view_renderer.rst @@ -10,7 +10,7 @@ View Renderer Using the View Renderer *********************** -The ``view()`` function is a convenience function that grabs an instance of the +The :php:func:`view()` function is a convenience function that grabs an instance of the ``renderer`` service, sets the data, and renders the view. While this is often exactly what you want, you may find times where you want to work with it more directly. In that case you can access the View service directly: @@ -84,7 +84,7 @@ If you don't want the data to be escaped, you can pass ``null`` or ``'raw'`` as :lines: 2- If you choose not to escape data, or you are passing in an object instance, you can manually escape the data within -the view with the ``esc()`` function. The first parameter is the string to escape. The second parameter is the +the view with the :php:func:`esc()` function. The first parameter is the string to escape. The second parameter is the context to escape the data for (see below):: getStat()) ?> From b7d56d5e06ee9c1829c557f8885172672472fbae Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Mar 2023 11:19:18 +0900 Subject: [PATCH 120/138] docs: add () after method name --- user_guide_src/source/outgoing/view_renderer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/view_renderer.rst b/user_guide_src/source/outgoing/view_renderer.rst index d2e97e5d6a71..a40314cc9985 100644 --- a/user_guide_src/source/outgoing/view_renderer.rst +++ b/user_guide_src/source/outgoing/view_renderer.rst @@ -118,7 +118,7 @@ Several options can be passed to the ``render()`` or ``renderString()`` methods: - ``cache_name`` - the ID used to save/retrieve a cached view result; defaults to the viewpath; ignored for ``renderString()`` - ``saveData`` - true if the view data parameters should be retained for subsequent calls -.. note:: ``saveData`` as defined by the interface must be a boolean, but implementing +.. note:: ``saveData()`` as defined by the interface must be a boolean, but implementing classes (like ``View`` below) may extend this to include ``null`` values. *************** From a55690a315ee12ede2ec7da7785ad62cfed06c25 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Mar 2023 11:21:23 +0900 Subject: [PATCH 121/138] docs: make method names linkable --- user_guide_src/source/outgoing/view_renderer.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/view_renderer.rst b/user_guide_src/source/outgoing/view_renderer.rst index a40314cc9985..618a90c4a516 100644 --- a/user_guide_src/source/outgoing/view_renderer.rst +++ b/user_guide_src/source/outgoing/view_renderer.rst @@ -29,7 +29,9 @@ can instantiate it directly: in your library's constructor. Then you can use any of the three standard methods that it provides: -**render(viewpath, options, save)**, **setVar(name, value, context)** and **setData(data, context)**. +:php:meth:`render() `, +:php:meth:`setVar() ` and +:php:meth:`setData() `. What It Does ============ From 06149c2a577e62ccc4054b2c286f2fd96f27b9a1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Mar 2023 11:24:42 +0900 Subject: [PATCH 122/138] docs: remove `:noindex:` --- user_guide_src/source/incoming/incomingrequest.rst | 2 -- user_guide_src/source/libraries/email.rst | 1 - 2 files changed, 3 deletions(-) diff --git a/user_guide_src/source/incoming/incomingrequest.rst b/user_guide_src/source/incoming/incomingrequest.rst index f54b1f9ff741..1cc1c545c084 100644 --- a/user_guide_src/source/incoming/incomingrequest.rst +++ b/user_guide_src/source/incoming/incomingrequest.rst @@ -417,7 +417,6 @@ The methods provided by the parent classes that are available are: Although GET data will be preferred in case of name conflict. .. php:method:: getCookie([$index = null[, $filter = null[, $flags = null]]]) - :noindex: :param mixed $index: COOKIE name :param int $filter: The type of filter to apply. A list of filters can be @@ -440,7 +439,6 @@ The methods provided by the parent classes that are available are: your configured ``Config\Cookie::$prefix`` value. .. php:method:: getServer([$index = null[, $filter = null[, $flags = null]]]) - :noindex: :param mixed $index: Value name :param int $filter: The type of filter to apply. A list of filters can be diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst index eaccf57da36b..0014d25de02b 100644 --- a/user_guide_src/source/libraries/email.rst +++ b/user_guide_src/source/libraries/email.rst @@ -269,7 +269,6 @@ Class Reference and strip the tags. .. php:method:: setHeader($header, $value) - :noindex: :param string $header: Header name :param string $value: Header value From fcc4de5dbf269ff5474a7b66ac31a3796898b3bd Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Mar 2023 12:53:11 +0900 Subject: [PATCH 123/138] fix: Cache FileHandler error when there is a folder in cache dir ErrorException: Automatic conversion of false to array is deprecated --- system/Cache/Handlers/FileHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Cache/Handlers/FileHandler.php b/system/Cache/Handlers/FileHandler.php index b95d7f9ee28c..c217c7edde8e 100644 --- a/system/Cache/Handlers/FileHandler.php +++ b/system/Cache/Handlers/FileHandler.php @@ -346,7 +346,7 @@ protected function getDirFileInfo(string $sourceDir, bool $topLevelOnly = true, while (false !== ($file = readdir($fp))) { if (is_dir($sourceDir . $file) && $file[0] !== '.' && $topLevelOnly === false) { $this->getDirFileInfo($sourceDir . $file . DIRECTORY_SEPARATOR, $topLevelOnly, true); - } elseif ($file[0] !== '.') { + } elseif (! is_dir($sourceDir . $file) && $file[0] !== '.') { $_filedata[$file] = $this->getFileInfo($sourceDir . $file); $_filedata[$file]['relative_path'] = $relativePath; } From 0fb5f6828e4206ddbe0a44821b54d2278ab4a76d Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Tue, 21 Mar 2023 10:15:16 +0330 Subject: [PATCH 124/138] docs: add UG common link for more info --- app/Common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Common.php b/app/Common.php index 23e3e614a0a0..95f554425236 100644 --- a/app/Common.php +++ b/app/Common.php @@ -11,5 +11,5 @@ * loaded early on, and may also contain additional functions * that you'd like to use throughout your entire application * - * @see: https://codeigniter4.github.io/CodeIgniter4/ + * @see: https://codeigniter.com/user_guide/extending/common.html */ From 8a256a2f005466c14095cb02c2dea8a659b1a8a4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 21 Mar 2023 18:09:18 +0900 Subject: [PATCH 125/138] docs: fix section title level --- user_guide_src/source/dbmgmt/seeds.rst | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/user_guide_src/source/dbmgmt/seeds.rst b/user_guide_src/source/dbmgmt/seeds.rst index 9eb9ee4396f9..087011e2fd83 100644 --- a/user_guide_src/source/dbmgmt/seeds.rst +++ b/user_guide_src/source/dbmgmt/seeds.rst @@ -14,8 +14,9 @@ stored within the **app/Database/Seeds** directory. The name of the file must ma .. literalinclude:: seeds/001.php +*************** Nesting Seeders -=============== +*************** Seeders can call other seeders, with the **call()** method. This allows you to easily organize a central seeder, but organize the tasks into separate seeder files: @@ -27,23 +28,25 @@ anywhere the autoloader can find them. This is great for more modular code bases .. literalinclude:: seeds/003.php +************* Using Seeders -============= +************* You can grab a copy of the main seeder through the database config class: .. literalinclude:: seeds/004.php Command Line Seeding --------------------- +==================== You can also seed data from the command line, as part of the Migrations CLI tools, if you don't want to create a dedicated controller:: > php spark db:seed TestSeeder -Creating Seed Files -------------------- +********************* +Creating Seeder Files +********************* Using the command line, you can easily generate seed files. From 00abda1300116e55b60c205e8b6bbd939a882565 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 21 Mar 2023 18:09:53 +0900 Subject: [PATCH 126/138] docs: replace seeds with seeders For consistency. --- user_guide_src/source/dbmgmt/seeds.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/dbmgmt/seeds.rst b/user_guide_src/source/dbmgmt/seeds.rst index 087011e2fd83..fb21f3ff2e8e 100644 --- a/user_guide_src/source/dbmgmt/seeds.rst +++ b/user_guide_src/source/dbmgmt/seeds.rst @@ -4,10 +4,10 @@ Database Seeding Database seeding is a simple way to add data into your database. It is especially useful during development where you need to populate the database with sample data that you can develop against, but it is not limited to that. -Seeds can contain static data that you don't want to include in a migration, like countries, or geo-coding tables, +Seeders can contain static data that you don't want to include in a migration, like countries, or geo-coding tables, event or setting information, and more. -Database seeds are simple classes that must have a **run()** method, and extend ``CodeIgniter\Database\Seeder``. +Database seeders are simple classes that must have a **run()** method, and extend ``CodeIgniter\Database\Seeder``. Within the **run()** the class can create any form of data that it needs to. It has access to the database connection and the forge through ``$this->db`` and ``$this->forge``, respectively. Seed files must be stored within the **app/Database/Seeds** directory. The name of the file must match the name of the class. From 39af027fbf54d1a5ff05cb3df70e22649d35f9c7 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 21 Mar 2023 18:10:18 +0900 Subject: [PATCH 127/138] docs: add section title and TOC --- user_guide_src/source/dbmgmt/seeds.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/user_guide_src/source/dbmgmt/seeds.rst b/user_guide_src/source/dbmgmt/seeds.rst index fb21f3ff2e8e..bdf2ff28a5fa 100644 --- a/user_guide_src/source/dbmgmt/seeds.rst +++ b/user_guide_src/source/dbmgmt/seeds.rst @@ -7,6 +7,14 @@ you need to populate the database with sample data that you can develop against, Seeders can contain static data that you don't want to include in a migration, like countries, or geo-coding tables, event or setting information, and more. +.. contents:: + :local: + :depth: 2 + +**************** +Database Seeders +**************** + Database seeders are simple classes that must have a **run()** method, and extend ``CodeIgniter\Database\Seeder``. Within the **run()** the class can create any form of data that it needs to. It has access to the database connection and the forge through ``$this->db`` and ``$this->forge``, respectively. Seed files must be From f9cc308250f406f1525cddddce2e797cf0545113 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 21 Mar 2023 18:12:53 +0900 Subject: [PATCH 128/138] docs: change text decoration --- user_guide_src/source/dbmgmt/seeds.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/user_guide_src/source/dbmgmt/seeds.rst b/user_guide_src/source/dbmgmt/seeds.rst index bdf2ff28a5fa..7ea6ec2e310a 100644 --- a/user_guide_src/source/dbmgmt/seeds.rst +++ b/user_guide_src/source/dbmgmt/seeds.rst @@ -15,8 +15,8 @@ event or setting information, and more. Database Seeders **************** -Database seeders are simple classes that must have a **run()** method, and extend ``CodeIgniter\Database\Seeder``. -Within the **run()** the class can create any form of data that it needs to. It has access to the database +Database seeders are simple classes that must have a ``run()`` method, and extend ``CodeIgniter\Database\Seeder``. +Within the ``run()`` the class can create any form of data that it needs to. It has access to the database connection and the forge through ``$this->db`` and ``$this->forge``, respectively. Seed files must be stored within the **app/Database/Seeds** directory. The name of the file must match the name of the class. @@ -26,12 +26,12 @@ stored within the **app/Database/Seeds** directory. The name of the file must ma Nesting Seeders *************** -Seeders can call other seeders, with the **call()** method. This allows you to easily organize a central seeder, +Seeders can call other seeders, with the ``call()`` method. This allows you to easily organize a central seeder, but organize the tasks into separate seeder files: .. literalinclude:: seeds/002.php -You can also use a fully-qualified class name in the **call()** method, allowing you to keep your seeders +You can also use a fully-qualified class name in the ``call()`` method, allowing you to keep your seeders anywhere the autoloader can find them. This is great for more modular code bases: .. literalinclude:: seeds/003.php @@ -63,10 +63,10 @@ Using the command line, you can easily generate seed files. > php spark make:seeder user --suffix // Output: UserSeeder.php file located at app/Database/Seeds directory. -You can supply the **root** namespace where the seed file will be stored by supplying the ``--namespace`` option:: +You can supply the ``root`` namespace where the seed file will be stored by supplying the ``--namespace`` option:: > php spark make:seeder MySeeder --namespace Acme\\Blog -If ``Acme\Blog`` is mapped to ``app/Blog`` directory, then this command will generate ``MySeeder.php`` at ``app/Blog/Database/Seeds`` directory. +If ``Acme\Blog`` is mapped to **app/Blog** directory, then this command will generate **MySeeder.php** at **app/Blog/Database/Seeds** directory. Supplying the ``--force`` option will overwrite existing files in destination. From 47ef1cb487f64ced5266b93ec3c0b96b9e9b6e42 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Mar 2023 09:05:21 +0900 Subject: [PATCH 129/138] docs: add sample command for Windows --- user_guide_src/source/dbmgmt/seeds.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/user_guide_src/source/dbmgmt/seeds.rst b/user_guide_src/source/dbmgmt/seeds.rst index 7ea6ec2e310a..a846705e56c8 100644 --- a/user_guide_src/source/dbmgmt/seeds.rst +++ b/user_guide_src/source/dbmgmt/seeds.rst @@ -65,8 +65,12 @@ Using the command line, you can easily generate seed files. You can supply the ``root`` namespace where the seed file will be stored by supplying the ``--namespace`` option:: + For Unix: > php spark make:seeder MySeeder --namespace Acme\\Blog + For Windows: + > php spark make:seeder MySeeder --namespace Acme\Blog + If ``Acme\Blog`` is mapped to **app/Blog** directory, then this command will generate **MySeeder.php** at **app/Blog/Database/Seeds** directory. Supplying the ``--force`` option will overwrite existing files in destination. From c7a92d3bbc99ab3dd5a5afe64191c325d3679e23 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 22 Mar 2023 09:07:10 +0900 Subject: [PATCH 130/138] docs: add sample command for Windows --- user_guide_src/source/dbmgmt/migration.rst | 4 ++++ user_guide_src/source/general/modules.rst | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/user_guide_src/source/dbmgmt/migration.rst b/user_guide_src/source/dbmgmt/migration.rst index 117cdaacd099..616f782dce01 100644 --- a/user_guide_src/source/dbmgmt/migration.rst +++ b/user_guide_src/source/dbmgmt/migration.rst @@ -128,8 +128,12 @@ You can use (migrate) with the following options: This example will migrate ``Acme\Blog`` namespace with any new migrations on the test database group:: + For Unix: > php spark migrate -g test -n Acme\\Blog + For Windows: + > php spark migrate -g test -n Acme\Blog + When using the ``--all`` option, it will scan through all namespaces attempting to find any migrations that have not been run. These will all be collected and then sorted as a group by date created. This should help to minimize any potential conflicts between the main application and any modules. diff --git a/user_guide_src/source/general/modules.rst b/user_guide_src/source/general/modules.rst index 6c3eb08f792c..2298c32a986f 100644 --- a/user_guide_src/source/general/modules.rst +++ b/user_guide_src/source/general/modules.rst @@ -208,8 +208,12 @@ Seeds Seed files can be used from both the CLI and called from within other seed files as long as the full namespace is provided. If calling on the CLI, you will need to provide double backslashes:: + For Unix: > php spark db:seed Acme\\Blog\\Database\\Seeds\\TestPostSeeder + For Windows: + > php spark db:seed Acme\Blog\Database\Seeds\TestPostSeeder + Helpers ======= From b88fdaf3ebc3810d2ede125ce65cd8fcbf4613d5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Mar 2023 15:57:06 +0000 Subject: [PATCH 131/138] chore(deps-dev): update rector/rector requirement Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.21...0.15.23) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index beb77d7dc7b5..3f176b01f8f4 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "phpunit/phpcov": "^8.2", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1 || ^2.0", - "rector/rector": "0.15.21", + "rector/rector": "0.15.23", "vimeo/psalm": "^5.0" }, "suggest": { From 2508a768f2b6c407a29ea06b13190cb3b0227747 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 24 Mar 2023 12:47:54 +0900 Subject: [PATCH 132/138] test: Temporary solution for PHP 8.2.4 SIGSEGV #7362 --- tests/system/I18n/TimeLegacyTest.php | 21 +++++++++++---------- tests/system/I18n/TimeTest.php | 21 +++++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/tests/system/I18n/TimeLegacyTest.php b/tests/system/I18n/TimeLegacyTest.php index 02585a25d11e..b839ef4c506c 100644 --- a/tests/system/I18n/TimeLegacyTest.php +++ b/tests/system/I18n/TimeLegacyTest.php @@ -1124,16 +1124,17 @@ public function testGetter() $this->assertNull($time->weekOfWeek); } - public function testUnserializeTimeObject() - { - $time1 = new TimeLegacy('August 28, 2020 10:04:00pm', 'Asia/Manila', 'en'); - $timeCache = serialize($time1); - $time2 = unserialize($timeCache); - - $this->assertInstanceOf(TimeLegacy::class, $time2); - $this->assertTrue($time2->equals($time1)); - $this->assertNotSame($time1, $time2); - } + // @TODO Uncomment when PHP 8.2.4 Segmentation fault fixed. +// public function testUnserializeTimeObject() +// { +// $time1 = new TimeLegacy('August 28, 2020 10:04:00pm', 'Asia/Manila', 'en'); +// $timeCache = serialize($time1); +// $time2 = unserialize($timeCache); +// +// $this->assertInstanceOf(TimeLegacy::class, $time2); +// $this->assertTrue($time2->equals($time1)); +// $this->assertNotSame($time1, $time2); +// } public function testSetTestNowWithFaLocale() { diff --git a/tests/system/I18n/TimeTest.php b/tests/system/I18n/TimeTest.php index fe1360f576a1..deac2760ac81 100644 --- a/tests/system/I18n/TimeTest.php +++ b/tests/system/I18n/TimeTest.php @@ -1127,16 +1127,17 @@ public function testGetter() $this->assertNull($time->weekOfWeek); } - public function testUnserializeTimeObject() - { - $time1 = new Time('August 28, 2020 10:04:00pm', 'Asia/Manila', 'en'); - $timeCache = serialize($time1); - $time2 = unserialize($timeCache); - - $this->assertInstanceOf(Time::class, $time2); - $this->assertTrue($time2->equals($time1)); - $this->assertNotSame($time1, $time2); - } + // @TODO Uncomment when PHP 8.2.4 Segmentation fault fixed. +// public function testUnserializeTimeObject() +// { +// $time1 = new Time('August 28, 2020 10:04:00pm', 'Asia/Manila', 'en'); +// $timeCache = serialize($time1); +// $time2 = unserialize($timeCache); +// +// $this->assertInstanceOf(Time::class, $time2); +// $this->assertTrue($time2->equals($time1)); +// $this->assertNotSame($time1, $time2); +// } public function testSetTestNowWithTimeZone() { From e6867318b3e33c1535e505098786d666cccd48ff Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 25 Mar 2023 13:12:07 +0900 Subject: [PATCH 133/138] docs: replace With with with --- user_guide_src/source/database/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/index.rst b/user_guide_src/source/database/index.rst index 73cd1a4ecff9..0862ec0f4125 100644 --- a/user_guide_src/source/database/index.rst +++ b/user_guide_src/source/database/index.rst @@ -1,5 +1,5 @@ ###################### -Working With Databases +Working with Databases ###################### CodeIgniter comes with a full-featured and very fast abstracted database From b89a97f6517bdcec434b2630fafc95fd85587c05 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 25 Mar 2023 13:12:26 +0900 Subject: [PATCH 134/138] docs: increase TOC depth --- user_guide_src/source/database/results.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst index 39dd584e8003..2dda585d9b2c 100644 --- a/user_guide_src/source/database/results.rst +++ b/user_guide_src/source/database/results.rst @@ -6,7 +6,7 @@ There are several ways to generate query results: .. contents:: :local: - :depth: 2 + :depth: 3 ************* Result Arrays From 3201a02ffa0fc60749ed550a3ab9cecccd7dcd2c Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 25 Mar 2023 13:12:47 +0900 Subject: [PATCH 135/138] docs: add sub section titles --- user_guide_src/source/database/results.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst index 2dda585d9b2c..0f64e02c6f3b 100644 --- a/user_guide_src/source/database/results.rst +++ b/user_guide_src/source/database/results.rst @@ -16,13 +16,21 @@ getResult() =========== This method returns the query result as an array of **objects**, or -**an empty array** on failure. Typically you'll use this in a foreach +**an empty array** on failure. + +Getting an Array of stdClass +---------------------------- + +Typically you'll use this in a foreach loop, like this: .. literalinclude:: results/001.php The above method is an alias of ``getResultObject()``. +Getting an Array of Array +------------------------- + You can pass in the string 'array' if you wish to get your results as an array of arrays: @@ -30,6 +38,9 @@ as an array of arrays: The above usage is an alias of ``getResultArray()``. +Getting an Array of Custom Object +--------------------------------- + You can also pass a string to ``getResult()`` which represents a class to instantiate for each result object From e40d25ff231c63ee7dd6d80c5b242bfbf569a53c Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 25 Mar 2023 13:18:30 +0900 Subject: [PATCH 136/138] docs: make method names linkable --- user_guide_src/source/database/results.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst index 0f64e02c6f3b..a5d490a81a20 100644 --- a/user_guide_src/source/database/results.rst +++ b/user_guide_src/source/database/results.rst @@ -26,7 +26,7 @@ loop, like this: .. literalinclude:: results/001.php -The above method is an alias of ``getResultObject()``. +The above method is an alias of :php:meth:`CodeIgniter\\Database\\BaseResult::getResultObject()`. Getting an Array of Array ------------------------- @@ -36,7 +36,7 @@ as an array of arrays: .. literalinclude:: results/002.php -The above usage is an alias of ``getResultArray()``. +The above usage is an alias of `getResultArray()`_. Getting an Array of Custom Object --------------------------------- @@ -46,7 +46,7 @@ instantiate for each result object .. literalinclude:: results/003.php -The above method is an alias of ``getCustomResultObject()``. +The above method is an alias of `getCustomResultObject()`_. getResultArray() ================ @@ -283,7 +283,7 @@ Class Reference Returns the query results as an array of rows, where each row is an object of type ``stdClass``. - Usage: see `Result Arrays`_. + Usage: see `Getting an Array of stdClass`_. .. php:method:: getCustomResultObject($class_name) From 0d15f89eb20a47f6dac32c7f5c404ff3d3e3bca1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 25 Mar 2023 19:10:32 +0900 Subject: [PATCH 137/138] Prep for 4.3.3 release --- CHANGELOG.md | 27 +++++++++++++++++++ system/CodeIgniter.php | 2 +- user_guide_src/source/changelogs/v4.3.3.rst | 2 +- user_guide_src/source/conf.py | 2 +- .../source/installation/upgrade_433.rst | 4 ++- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 509652f7ea87..cabf78eba583 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog +## [v4.3.3](https://github.com/codeigniter4/CodeIgniter4/tree/v4.3.3) (2023-03-26) +[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.3.2...v4.3.3) + +### Fixed Bugs + +* docs: fix $systemDirectory path in existing project. by @jozefrebjak in https://github.com/codeigniter4/CodeIgniter4/pull/7289 +* docs: fix message.rst and improve content_negotiation.rst by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7280 +* fix: Encryption CI3 compatibility by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7273 +* fix: [QueryBuilder] RawSql causes error when using like() and countAllResults() by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7277 +* fix: handling of null bytes in `Exceptions::renderBacktrace()` by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/7306 +* fix: incorrect metadata querying of Redis cache by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/7307 +* fix: [Email] add missing TLS 1.3 support by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7317 +* docs: add warning to random_string() by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7333 +* fix: random_string() numeric by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7336 +* docs: add note for addColumn() and NULL by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7342 +* fix: respondNoContent() returns Kint script in development mode by @anggadarkprince in https://github.com/codeigniter4/CodeIgniter4/pull/7347 +* fix: use first exception in exceptionHandler() by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7341 +* fix: random_string() alpha alnum nozero by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7344 +* fix: migrate:rollback -b negative number by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7350 +* fix: site_url() does not support protocol-relative links by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7353 +* docs: add uri_string() BC in v4.3.2 by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7356 +* fix: Cache FileHandler error when there is a folder in cache dir by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7361 + +### Refactoring + +* refactor: consistent header name case by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7299 + ## [v4.3.2](https://github.com/codeigniter4/CodeIgniter4/tree/v4.3.2) (2023-02-18) [Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.3.1...v4.3.2) diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index d370e34ca22e..42ddaa0c073c 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -47,7 +47,7 @@ class CodeIgniter /** * The current version of CodeIgniter Framework */ - public const CI_VERSION = '4.3.2'; + public const CI_VERSION = '4.3.3'; /** * App startup time. diff --git a/user_guide_src/source/changelogs/v4.3.3.rst b/user_guide_src/source/changelogs/v4.3.3.rst index 4681fde8604b..1430cf767aea 100644 --- a/user_guide_src/source/changelogs/v4.3.3.rst +++ b/user_guide_src/source/changelogs/v4.3.3.rst @@ -1,7 +1,7 @@ Version 4.3.3 ################# -Release Date: Unreleased +Release Date: March 26, 2023 **4.3.3 release of CodeIgniter4** diff --git a/user_guide_src/source/conf.py b/user_guide_src/source/conf.py index 936eff54be31..0fae19186417 100644 --- a/user_guide_src/source/conf.py +++ b/user_guide_src/source/conf.py @@ -26,7 +26,7 @@ version = '4.3' # The full version, including alpha/beta/rc tags. -release = '4.3.2' +release = '4.3.3' # -- General configuration --------------------------------------------------- diff --git a/user_guide_src/source/installation/upgrade_433.rst b/user_guide_src/source/installation/upgrade_433.rst index 2196484b502b..95422dddc4c7 100644 --- a/user_guide_src/source/installation/upgrade_433.rst +++ b/user_guide_src/source/installation/upgrade_433.rst @@ -46,4 +46,6 @@ 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/Common.php +- app/Config/Encryption.php +- composer.json From 96b45e0aad8219c3371a52522a039b889c183e90 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 25 Mar 2023 19:14:35 +0900 Subject: [PATCH 138/138] docs: remove empty section's title --- user_guide_src/source/changelogs/v4.3.3.rst | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/user_guide_src/source/changelogs/v4.3.3.rst b/user_guide_src/source/changelogs/v4.3.3.rst index 1430cf767aea..cd9d3fc31a40 100644 --- a/user_guide_src/source/changelogs/v4.3.3.rst +++ b/user_guide_src/source/changelogs/v4.3.3.rst @@ -16,18 +16,6 @@ SECURITY - **Text Helper:** The :php:func:`random_string()` type **alpha**, **alnum**, **numeric** and **nozero** are now cryptographically secure. -BREAKING -******** - -Message Changes -*************** - -Changes -******* - -Deprecations -************ - Bugs Fixed **********