From 7c87f07f4c9f2bb77ef74dd34675a774c24f3609 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 11 Jul 2023 18:02:03 +0900 Subject: [PATCH 1/4] refactor: move callExit() to index.php --- public/index.php | 4 ++++ system/CodeIgniter.php | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/public/index.php b/public/index.php index a6d943a9d861..d031ea10944a 100644 --- a/public/index.php +++ b/public/index.php @@ -67,3 +67,7 @@ */ $app->run(); + +// Exits the application, setting the exit code for CLI-based applications +// that might be watching. +exit(EXIT_SUCCESS); diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 760cd7324403..8bdcc15bc16e 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -372,7 +372,6 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon } $this->sendResponse(); - $this->callExit(EXIT_SUCCESS); } /** @@ -1088,6 +1087,8 @@ protected function sendResponse() * without actually stopping script execution. * * @param int $code + * + * @deprecated 4.4.0 No longer Used. Moved to index.php. */ protected function callExit($code) { From 5b26b28350129b17343c0209ca1c14433aa9f3b4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 9 Aug 2023 17:45:37 +0900 Subject: [PATCH 2/4] docs: add changelog --- user_guide_src/source/changelogs/v4.4.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelogs/v4.4.0.rst b/user_guide_src/source/changelogs/v4.4.0.rst index 6d27223fc02a..483637095007 100644 --- a/user_guide_src/source/changelogs/v4.4.0.rst +++ b/user_guide_src/source/changelogs/v4.4.0.rst @@ -263,6 +263,7 @@ Deprecations - ``CodeIgniter::cache()`` method is deprecated. No longer used. Use ``ResponseCache`` instead. - ``CodeIgniter::cachePage()`` method is deprecated. No longer used. Use ``ResponseCache`` instead. - ``CodeIgniter::generateCacheName()`` method is deprecated. No longer used. Use ``ResponseCache`` instead. + - ``CodeIgniter::callExit()`` method is deprecated. No longer used. - **RedirectException:** ``\CodeIgniter\Router\Exceptions\RedirectException`` is deprecated. Use ``\CodeIgniter\HTTP\Exceptions\RedirectException`` instead. - **Session:** The property ``$sessionDriverName``, ``$sessionCookieName``, ``$sessionExpiration``, ``$sessionSavePath``, ``$sessionMatchIP``, From 006d38ce6f283ca68845d7ff114cf1d7659108ba Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 11 Aug 2023 12:07:48 +0900 Subject: [PATCH 3/4] docs: add @deprecated in MockCodeIgniter --- system/Test/Mock/MockCodeIgniter.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/Test/Mock/MockCodeIgniter.php b/system/Test/Mock/MockCodeIgniter.php index e6d6ac0f6c61..200c92fa0396 100644 --- a/system/Test/Mock/MockCodeIgniter.php +++ b/system/Test/Mock/MockCodeIgniter.php @@ -17,6 +17,11 @@ class MockCodeIgniter extends CodeIgniter { protected ?string $context = 'web'; + /** + * @param int $code + * + * @deprecated 4.4.0 No longer Used. Moved to index.php. + */ protected function callExit($code) { // Do not call exit() in testing. From 13251a2e3a19c1ae24bf00f0ed3c74490bd4178f Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 13 Aug 2023 12:05:40 +0900 Subject: [PATCH 4/4] docs: add changelog and ugrade note --- user_guide_src/source/changelogs/v4.4.0.rst | 8 ++++++++ .../source/installation/upgrade_440.rst | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/user_guide_src/source/changelogs/v4.4.0.rst b/user_guide_src/source/changelogs/v4.4.0.rst index 483637095007..4b7b065cd6e2 100644 --- a/user_guide_src/source/changelogs/v4.4.0.rst +++ b/user_guide_src/source/changelogs/v4.4.0.rst @@ -64,6 +64,14 @@ Autoloader Previously, CodeIgniter's autoloader allowed loading class names ending with the `.php` extension. This means instantiating objects like `new Foo.php()` was possible and would instantiate as `new Foo()`. Since `Foo.php` is an invalid class name, this behavior of the autoloader is changed. Now, instantiating such classes would fail. +.. _v440-codeigniter-and-exit: + +CodeIgniter and exit() +---------------------- + +The ``CodeIgniter::run()`` method no longer calls ``exit(EXIT_SUCCESS)``. The +exit call is moved to **public/index.php**. + .. _v440-interface-changes: Interface Changes diff --git a/user_guide_src/source/installation/upgrade_440.rst b/user_guide_src/source/installation/upgrade_440.rst index b740c68d7b5f..ffb8751c5206 100644 --- a/user_guide_src/source/installation/upgrade_440.rst +++ b/user_guide_src/source/installation/upgrade_440.rst @@ -117,6 +117,24 @@ match the new array structure. Mandatory File Changes ********************** +index.php +========= + +The following file received significant changes and +**you must merge the updated versions** with your application: + +- ``public/index.php`` (see also :ref:`v440-codeigniter-and-exit`) + +.. important:: If you don't update the above file, CodeIgniter will not work + properly after running ``composer update``. + + The upgrade procedure, for example, is as follows: + + .. code-block:: console + + composer update + cp vendor/codeigniter4/framework/public/index.php public/index.php + Config Files ============