Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move callExit() to index.php #7800

Merged
merged 4 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@
*/

$app->run();

// Exits the application, setting the exit code for CLI-based applications
// that might be watching.
exit(EXIT_SUCCESS);
3 changes: 2 additions & 1 deletion system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
}

$this->sendResponse();
$this->callExit(EXIT_SUCCESS);
}

/**
Expand Down Expand Up @@ -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.
samsonasik marked this conversation as resolved.
Show resolved Hide resolved
*/
protected function callExit($code)
{
Expand Down
5 changes: 5 additions & 0 deletions system/Test/Mock/MockCodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 9 additions & 0 deletions user_guide_src/source/changelogs/v4.4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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``,
Expand Down
18 changes: 18 additions & 0 deletions user_guide_src/source/installation/upgrade_440.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
============

Expand Down
Loading