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) { 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. diff --git a/user_guide_src/source/changelogs/v4.4.0.rst b/user_guide_src/source/changelogs/v4.4.0.rst index 6d27223fc02a..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 @@ -263,6 +271,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``, 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 ============