Skip to content

Commit 1d08b04

Browse files
committed
Merge branch 'release-4.0.0-alpha.2'
2 parents 88965ed + 65a480c commit 1d08b04

File tree

28 files changed

+626
-180
lines changed

28 files changed

+626
-180
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,15 @@ Please read the [*Contributing to CodeIgniter*](https://github.com/bcit-ci/CodeI
6868
## Server Requirements
6969
PHP version 7.1 or higher is required, with the following extensions installed:
7070

71-
- intl
71+
- [intl](http://php.net/manual/en/intl.requirements.php)
72+
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library
7273

74+
Additionally, make sure that the following extensions are enabled in your PHP:
75+
76+
- json (enabled by default - don't turn it off)
77+
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
78+
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php)
79+
- xml (enabled by default - don't turn it off)
7380

7481
## Running CodeIgniter Tests
7582
Information on running CodeIgniter test suite can be found in the [README.md](tests/README.md) file in the tests directory.
Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
<?php
2-
32
/*
4-
|--------------------------------------------------------------------------
5-
| ERROR DISPLAY
6-
|--------------------------------------------------------------------------
7-
| In development, we want to show as many errors as possible to help
8-
| make sure they don't make it to production. And save us hours of
9-
| painful debugging.
10-
*/
3+
|--------------------------------------------------------------------------
4+
| ERROR DISPLAY
5+
|--------------------------------------------------------------------------
6+
| In development, we want to show as many errors as possible to help
7+
| make sure they don't make it to production. And save us hours of
8+
| painful debugging.
9+
*/
1110
error_reporting(-1);
1211
ini_set('display_errors', 1);
1312

1413
/*
15-
|--------------------------------------------------------------------------
16-
| DEBUG BACKTRACES
17-
|--------------------------------------------------------------------------
18-
| If true, this constant will tell the error screens to display debug
19-
| backtraces along with the other error information. If you would
20-
| prefer to not see this, set this value to false.
21-
*/
22-
define('SHOW_DEBUG_BACKTRACE', true);
14+
|--------------------------------------------------------------------------
15+
| DEBUG BACKTRACES
16+
|--------------------------------------------------------------------------
17+
| If true, this constant will tell the error screens to display debug
18+
| backtraces along with the other error information. If you would
19+
| prefer to not see this, set this value to false.
20+
*/
21+
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
2322

2423
/*
25-
|--------------------------------------------------------------------------
26-
| DEBUG MODE
27-
|--------------------------------------------------------------------------
28-
| Debug mode is an experimental flag that can allow changes throughout
29-
| the system. This will control whether Kint is loaded, and a few other
30-
| items. It can always be used within your own application too.
31-
*/
24+
|--------------------------------------------------------------------------
25+
| DEBUG MODE
26+
|--------------------------------------------------------------------------
27+
| Debug mode is an experimental flag that can allow changes throughout
28+
| the system. This will control whether Kint is loaded, and a few other
29+
| items. It can always be used within your own application too.
30+
*/
3231

33-
define('CI_DEBUG', 1);
32+
defined('CI_DEBUG') || define('CI_DEBUG', 1);
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<?php
22

33
/*
4-
|--------------------------------------------------------------------------
5-
| ERROR DISPLAY
6-
|--------------------------------------------------------------------------
7-
| Don't show ANY in production environments. Instead, let the system catch
8-
| it and display a generic error message.
9-
*/
4+
|--------------------------------------------------------------------------
5+
| ERROR DISPLAY
6+
|--------------------------------------------------------------------------
7+
| Don't show ANY in production environments. Instead, let the system catch
8+
| it and display a generic error message.
9+
*/
1010
ini_set('display_errors', 0);
1111
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
1212

1313
/*
14-
|--------------------------------------------------------------------------
15-
| DEBUG MODE
16-
|--------------------------------------------------------------------------
17-
| Debug mode is an experimental flag that can allow changes throughout
18-
| the system. It's not widely used currently, and may not survive
19-
| release of the framework.
20-
*/
14+
|--------------------------------------------------------------------------
15+
| DEBUG MODE
16+
|--------------------------------------------------------------------------
17+
| Debug mode is an experimental flag that can allow changes throughout
18+
| the system. It's not widely used currently, and may not survive
19+
| release of the framework.
20+
*/
2121

22-
define('CI_DEBUG', 0);
22+
defined('CI_DEBUG') || define('CI_DEBUG', 0);

application/Config/Boot/testing.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
<?php
22

33
/*
4-
|--------------------------------------------------------------------------
5-
| ERROR DISPLAY
6-
|--------------------------------------------------------------------------
7-
| In development, we want to show as many errors as possible to help
8-
| make sure they don't make it to production. And save us hours of
9-
| painful debugging.
10-
*/
4+
|--------------------------------------------------------------------------
5+
| ERROR DISPLAY
6+
|--------------------------------------------------------------------------
7+
| In development, we want to show as many errors as possible to help
8+
| make sure they don't make it to production. And save us hours of
9+
| painful debugging.
10+
*/
1111
error_reporting(-1);
1212
ini_set('display_errors', 1);
1313

1414
/*
15-
|--------------------------------------------------------------------------
16-
| DEBUG BACKTRACES
17-
|--------------------------------------------------------------------------
18-
| If true, this constant will tell the error screens to display debug
19-
| backtraces along with the other error information. If you would
20-
| prefer to not see this, set this value to false.
21-
*/
22-
define('SHOW_DEBUG_BACKTRACE', true);
15+
|--------------------------------------------------------------------------
16+
| DEBUG BACKTRACES
17+
|--------------------------------------------------------------------------
18+
| If true, this constant will tell the error screens to display debug
19+
| backtraces along with the other error information. If you would
20+
| prefer to not see this, set this value to false.
21+
*/
22+
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
2323

2424
/*
25-
|--------------------------------------------------------------------------
26-
| DEBUG MODE
27-
|--------------------------------------------------------------------------
28-
| Debug mode is an experimental flag that can allow changes throughout
29-
| the system. It's not widely used currently, and may not survive
30-
| release of the framework.
31-
*/
25+
|--------------------------------------------------------------------------
26+
| DEBUG MODE
27+
|--------------------------------------------------------------------------
28+
| Debug mode is an experimental flag that can allow changes throughout
29+
| the system. It's not widely used currently, and may not survive
30+
| release of the framework.
31+
*/
3232

33-
define('CI_DEBUG', 1);
33+
defined('CI_DEBUG') || define('CI_DEBUG', 1);

application/Config/Paths.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,16 @@ class Paths
7575
* with your host's needs.
7676
*/
7777
public $publicDirectory = 'public';
78+
79+
/*
80+
* ---------------------------------------------------------------
81+
* VIEW DIRECTORY NAME
82+
* ---------------------------------------------------------------
83+
*
84+
* This variable must contain the name of the directory that
85+
* contains the view files used by your application. By
86+
* default this is in `application/Views`. This value
87+
* is used when no value is provided to `Services::renderer()`.
88+
*/
89+
public $viewDirectory = 'application/Views';
7890
}

application/Views/welcome_message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
</pre>
125125

126126
<p>If you are exploring CodeIgniter for the very first time, you
127-
should start by reading the (in progress)
127+
should start by reading the
128128
<a href="https://bcit-ci.github.io/CodeIgniter4">User Guide</a>.</p>
129129

130130
</div>

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"php": ">=7.1",
2020
"zendframework/zend-escaper": "^2.5",
2121
"kint-php/kint": "^2.1",
22-
"ext-intl": "*"
22+
"ext-intl": "*",
23+
"ext-curl": "*"
2324
},
2425
"require-dev": {
2526
"phpunit/phpunit": "^7.0",

system/Autoloader/FileLocator.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
* Allows loading non-class files in a namespaced manner.
4444
* Works with Helpers, Views, etc.
4545
*
46-
* @todo sanitize filenames prior to checking them...
47-
*
46+
*
4847
* @package CodeIgniter
4948
*/
5049
class FileLocator
@@ -133,7 +132,6 @@ public function locateFile(string $file, string $folder = null, string $ext = 'p
133132
// IF we have a folder name, then the calling function
134133
// expects this file to be within that folder, like 'Views',
135134
// or 'libraries'.
136-
// @todo Allow it to check with and without the nested folder.
137135
if ( ! empty($folder) && strpos($filename, $folder) === false)
138136
{
139137
$filename = $folder . '/' . $filename;

system/CLI/CommandRunner.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<?php namespace CodeIgniter\CLI;
1+
<?php
2+
namespace CodeIgniter\CLI;
23

34
/**
45
* CodeIgniter
@@ -39,6 +40,7 @@
3940

4041
class CommandRunner extends Controller
4142
{
43+
4244
/**
4345
* Stores the info about found Commands.
4446
*
@@ -73,7 +75,6 @@ public function _remap($method, ...$params)
7375

7476
//--------------------------------------------------------------------
7577

76-
7778
/**
7879
* @param array $params
7980
*
@@ -143,12 +144,18 @@ protected function createCommandList()
143144
foreach ($files as $file)
144145
{
145146
$className = service('locator')->findQualifiedNameFromPath($file);
146-
147147
if (empty($className) || ! class_exists($className))
148148
{
149149
continue;
150150
}
151151

152+
$class = new \ReflectionClass($className);
153+
154+
if ( ! $class->isInstantiable() || ! $class->isSubclassOf(BaseCommand::class))
155+
{
156+
continue;
157+
}
158+
152159
$class = new $className($this->logger, $this);
153160

154161
// Store it!

system/CodeIgniter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,11 @@ protected function handleRequest(RouteCollectionInterface $routes = null, $cache
274274
$filters = Services::filters();
275275

276276
// If any filters were specified within the routes file,
277-
// we need to ensure it's active for the current request (before only)
277+
// we need to ensure it's active for the current request
278278
if (! is_null($routeFilter))
279279
{
280280
$filters->enableFilter($routeFilter, 'before');
281+
$filters->enableFilter($routeFilter, 'after');
281282
}
282283

283284
$uri = $this->request instanceof CLIRequest ? $this->request->getPath() : $this->request->uri->getPath();

0 commit comments

Comments
 (0)