Skip to content

Commit 4799e78

Browse files
authored
Merge pull request #7800 from kenjis/refactor-remove-callExit
refactor: move callExit() to index.php
2 parents 200cc6d + 13251a2 commit 4799e78

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

public/index.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,7 @@
6767
*/
6868

6969
$app->run();
70+
71+
// Exits the application, setting the exit code for CLI-based applications
72+
// that might be watching.
73+
exit(EXIT_SUCCESS);

system/CodeIgniter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
372372
}
373373

374374
$this->sendResponse();
375-
$this->callExit(EXIT_SUCCESS);
376375
}
377376

378377
/**
@@ -1088,6 +1087,8 @@ protected function sendResponse()
10881087
* without actually stopping script execution.
10891088
*
10901089
* @param int $code
1090+
*
1091+
* @deprecated 4.4.0 No longer Used. Moved to index.php.
10911092
*/
10921093
protected function callExit($code)
10931094
{

system/Test/Mock/MockCodeIgniter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ class MockCodeIgniter extends CodeIgniter
1717
{
1818
protected ?string $context = 'web';
1919

20+
/**
21+
* @param int $code
22+
*
23+
* @deprecated 4.4.0 No longer Used. Moved to index.php.
24+
*/
2025
protected function callExit($code)
2126
{
2227
// Do not call exit() in testing.

user_guide_src/source/changelogs/v4.4.0.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ Autoloader
6464
Previously, CodeIgniter's autoloader allowed loading class names ending with the `.php` extension. This means instantiating objects like `new Foo.php()` was possible
6565
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.
6666

67+
.. _v440-codeigniter-and-exit:
68+
69+
CodeIgniter and exit()
70+
----------------------
71+
72+
The ``CodeIgniter::run()`` method no longer calls ``exit(EXIT_SUCCESS)``. The
73+
exit call is moved to **public/index.php**.
74+
6775
.. _v440-interface-changes:
6876

6977
Interface Changes
@@ -263,6 +271,7 @@ Deprecations
263271
- ``CodeIgniter::cache()`` method is deprecated. No longer used. Use ``ResponseCache`` instead.
264272
- ``CodeIgniter::cachePage()`` method is deprecated. No longer used. Use ``ResponseCache`` instead.
265273
- ``CodeIgniter::generateCacheName()`` method is deprecated. No longer used. Use ``ResponseCache`` instead.
274+
- ``CodeIgniter::callExit()`` method is deprecated. No longer used.
266275
- **RedirectException:** ``\CodeIgniter\Router\Exceptions\RedirectException`` is deprecated. Use ``\CodeIgniter\HTTP\Exceptions\RedirectException`` instead.
267276
- **Session:** The property ``$sessionDriverName``, ``$sessionCookieName``,
268277
``$sessionExpiration``, ``$sessionSavePath``, ``$sessionMatchIP``,

user_guide_src/source/installation/upgrade_440.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,24 @@ match the new array structure.
117117
Mandatory File Changes
118118
**********************
119119

120+
index.php
121+
=========
122+
123+
The following file received significant changes and
124+
**you must merge the updated versions** with your application:
125+
126+
- ``public/index.php`` (see also :ref:`v440-codeigniter-and-exit`)
127+
128+
.. important:: If you don't update the above file, CodeIgniter will not work
129+
properly after running ``composer update``.
130+
131+
The upgrade procedure, for example, is as follows:
132+
133+
.. code-block:: console
134+
135+
composer update
136+
cp vendor/codeigniter4/framework/public/index.php public/index.php
137+
120138
Config Files
121139
============
122140

0 commit comments

Comments
 (0)