Skip to content

Commit 1f2fa2a

Browse files
committed
Release v4.0.4
1 parent 18bf776 commit 1f2fa2a

19 files changed

+125
-128
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ phpunit
8484
# Composer
8585
#-------------------------
8686
vendor/
87-
composer.lock
8887

8988
#-------------------------
9089
# IDE / Development Files
@@ -125,3 +124,4 @@ nb-configuration.xml
125124
/results/
126125
/phpunit*.xml
127126
/.phpunit.*.cache
127+

app/Config/Autoload.php

+50-72
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,66 @@
1-
<?php namespace Config;
1+
<?php
22

3-
require_once SYSTEMPATH . 'Config/AutoloadConfig.php';
3+
namespace Config;
4+
5+
use CodeIgniter\Config\AutoloadConfig;
46

57
/**
68
* -------------------------------------------------------------------
79
* AUTO-LOADER
810
* -------------------------------------------------------------------
911
* This file defines the namespaces and class maps so the Autoloader
1012
* can find the files as needed.
13+
*
14+
* NOTE: If you use an identical key in $psr4 or $classmap, then
15+
* the values in this file will overwrite the framework's values.
1116
*/
12-
class Autoload extends \CodeIgniter\Config\AutoloadConfig
17+
class Autoload extends AutoloadConfig
1318
{
14-
public $psr4 = [];
15-
16-
public $classmap = [];
17-
18-
//--------------------------------------------------------------------
1919

2020
/**
21-
* Collects the application-specific autoload settings and merges
22-
* them with the framework's required settings.
21+
* -------------------------------------------------------------------
22+
* Namespaces
23+
* -------------------------------------------------------------------
24+
* This maps the locations of any namespaces in your application to
25+
* their location on the file system. These are used by the autoloader
26+
* to locate files the first time they have been instantiated.
27+
*
28+
* The '/app' and '/system' directories are already mapped for you.
29+
* you may change the name of the 'App' namespace if you wish,
30+
* but this should be done prior to creating any namespaced classes,
31+
* else you will need to modify all of those classes for this to work.
2332
*
24-
* NOTE: If you use an identical key in $psr4 or $classmap, then
25-
* the values in this file will overwrite the framework's values.
33+
* Prototype:
34+
*
35+
* $psr4 = [
36+
* 'CodeIgniter' => SYSTEMPATH,
37+
* 'App' => APPPATH
38+
* ];
39+
*
40+
* @var array
2641
*/
27-
public function __construct()
28-
{
29-
parent::__construct();
30-
31-
/**
32-
* -------------------------------------------------------------------
33-
* Namespaces
34-
* -------------------------------------------------------------------
35-
* This maps the locations of any namespaces in your application
36-
* to their location on the file system. These are used by the
37-
* Autoloader to locate files the first time they have been instantiated.
38-
*
39-
* The '/app' and '/system' directories are already mapped for
40-
* you. You may change the name of the 'App' namespace if you wish,
41-
* but this should be done prior to creating any namespaced classes,
42-
* else you will need to modify all of those classes for this to work.
43-
*
44-
* DO NOT change the name of the CodeIgniter namespace or your application
45-
* WILL break. *
46-
* Prototype:
47-
*
48-
* $Config['psr4'] = [
49-
* 'CodeIgniter' => SYSPATH
50-
* `];
51-
*/
52-
$psr4 = [
53-
'App' => APPPATH, // To ensure filters, etc still found,
54-
APP_NAMESPACE => APPPATH, // For custom namespace
55-
'Config' => APPPATH . 'Config',
56-
];
57-
58-
/**
59-
* -------------------------------------------------------------------
60-
* Class Map
61-
* -------------------------------------------------------------------
62-
* The class map provides a map of class names and their exact
63-
* location on the drive. Classes loaded in this manner will have
64-
* slightly faster performance because they will not have to be
65-
* searched for within one or more directories as they would if they
66-
* were being autoloaded through a namespace.
67-
*
68-
* Prototype:
69-
*
70-
* $Config['classmap'] = [
71-
* 'MyClass' => '/path/to/class/file.php'
72-
* ];
73-
*/
74-
$classmap = [];
75-
76-
//--------------------------------------------------------------------
77-
// Do Not Edit Below This Line
78-
//--------------------------------------------------------------------
79-
80-
$this->psr4 = array_merge($this->psr4, $psr4);
81-
$this->classmap = array_merge($this->classmap, $classmap);
82-
83-
unset($psr4, $classmap);
84-
}
85-
86-
//--------------------------------------------------------------------
42+
public $psr4 = [
43+
APP_NAMESPACE => APPPATH, // For custom app namespace
44+
'Config' => APPPATH . 'Config',
45+
];
8746

47+
/**
48+
* -------------------------------------------------------------------
49+
* Class Map
50+
* -------------------------------------------------------------------
51+
* The class map provides a map of class names and their exact
52+
* location on the drive. Classes loaded in this manner will have
53+
* slightly faster performance because they will not have to be
54+
* searched for within one or more directories as they would if they
55+
* were being autoloaded through a namespace.
56+
*
57+
* Prototype:
58+
*
59+
* $classmap = [
60+
* 'MyClass' => '/path/to/class/file.php'
61+
* ];
62+
*
63+
* @var array
64+
*/
65+
public $classmap = [];
8866
}

app/Config/Boot/development.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929
| items. It can always be used within your own application too.
3030
*/
3131

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

app/Config/Boot/production.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
| release of the framework.
2020
*/
2121

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

app/Config/Boot/testing.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
| release of the framework.
3131
*/
3232

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

app/Config/Events.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php namespace Config;
22

33
use CodeIgniter\Events\Events;
4+
use CodeIgniter\Exceptions\FrameworkException;
45

56
/*
67
* --------------------------------------------------------------------
@@ -22,12 +23,17 @@
2223
Events::on('pre_system', function () {
2324
if (ENVIRONMENT !== 'testing')
2425
{
25-
while (\ob_get_level() > 0)
26+
if (ini_get('zlib.output_compression'))
2627
{
27-
\ob_end_flush();
28+
throw FrameworkException::forEnabledZlibOutputCompression();
2829
}
2930

30-
\ob_start(function ($buffer) {
31+
while (ob_get_level() > 0)
32+
{
33+
ob_end_flush();
34+
}
35+
36+
ob_start(function ($buffer) {
3137
return $buffer;
3238
});
3339
}

app/Config/Exceptions.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php namespace Config;
22

3+
use CodeIgniter\Config\BaseConfig;
4+
35
/**
46
* Setup how the exception handler works.
57
*
68
* @package Config
79
*/
8-
9-
class Exceptions
10+
class Exceptions extends BaseConfig
1011
{
1112
/*
1213
|--------------------------------------------------------------------------

app/Config/Format.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,21 @@ class Format extends BaseConfig
3939
'application/xml' => \CodeIgniter\Format\XMLFormatter::class,
4040
'text/xml' => \CodeIgniter\Format\XMLFormatter::class,
4141
];
42-
42+
43+
/*
44+
|--------------------------------------------------------------------------
45+
| Formatters Options
46+
|--------------------------------------------------------------------------
47+
|
48+
| Additional Options to adjust default formatters behaviour.
49+
| For each mime type, list the additional options that should be used.
50+
|
51+
*/
52+
public $formatterOptions = [
53+
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
54+
'application/xml' => 0,
55+
'text/xml' => 0,
56+
];
4357
//--------------------------------------------------------------------
4458

4559
/**

app/Config/Honeypot.php

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Honeypot extends BaseConfig
1111
* @var boolean
1212
*/
1313
public $hidden = true;
14+
1415
/**
1516
* Honeypot Label Content
1617
*
@@ -31,4 +32,11 @@ class Honeypot extends BaseConfig
3132
* @var string
3233
*/
3334
public $template = '<label>{label}</label><input type="text" name="{name}" value=""/>';
35+
36+
/**
37+
* Honeypot container
38+
*
39+
* @var string
40+
*/
41+
public $container = '<div style="display:none">{template}</div>';
3442
}

app/Config/Images.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Images extends BaseConfig
2222
/**
2323
* The available handler classes.
2424
*
25-
* @var array
25+
* @var \CodeIgniter\Images\Handlers\BaseHandler[]
2626
*/
2727
public $handlers = [
2828
'gd' => \CodeIgniter\Images\Handlers\GDHandler::class,

app/Config/Modules.php

+10-32
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
<?php namespace Config;
1+
<?php
22

3-
// Cannot extend BaseConfig or looping resources occurs.
4-
class Modules
3+
namespace Config;
4+
5+
use CodeIgniter\Modules\Modules as CoreModules;
6+
7+
class Modules extends CoreModules
58
{
69
/*
710
|--------------------------------------------------------------------------
@@ -29,39 +32,14 @@ class Modules
2932
| Auto-discover Rules
3033
|--------------------------------------------------------------------------
3134
|
32-
| Lists the aliases of all discovery classes that will be active
33-
| and used during the current application request. If it is not
34-
| listed here, only the base application elements will be used.
35+
| Aliases list of all discovery classes that will be active and used during
36+
| the current application request.
37+
| If it is not listed, only the base application elements will be used.
3538
*/
36-
public $activeExplorers = [
39+
public $aliases = [
3740
'events',
3841
'registrars',
3942
'routes',
4043
'services',
4144
];
42-
43-
/**
44-
* Should the application auto-discover the requested resources.
45-
*
46-
* Valid values are:
47-
* - events
48-
* - registrars
49-
* - routes
50-
* - services
51-
*
52-
* @param string $alias
53-
*
54-
* @return boolean
55-
*/
56-
public function shouldDiscover(string $alias)
57-
{
58-
if (! $this->enabled)
59-
{
60-
return false;
61-
}
62-
63-
$alias = strtolower($alias);
64-
65-
return in_array($alias, $this->activeExplorers);
66-
}
6745
}

app/Config/Routes.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* --------------------------------------------------------------------
3939
*
4040
* There will often be times that you need additional routing and you
41-
* need to it be able to override any defaults in this file. Environment
41+
* need it to be able to override any defaults in this file. Environment
4242
* based routes is one such time. require() additional route files here
4343
* to make that happen.
4444
*

app/Config/Services.php

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
use CodeIgniter\Config\Services as CoreServices;
44

5-
require_once SYSTEMPATH . 'Config/Services.php';
6-
75
/**
86
* Services Configuration file.
97
*

app/Language/en/Validation.php

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
3+
// override core en language system validation or define your own en language validation message
4+
return [];

app/Views/errors/html/debug.css

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ p.lead {
6464
border-radius: 5px;
6565
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
6666
margin: 0;
67+
overflow-x: scroll;
6768
}
6869
.source span.line {
6970
line-height: 1.4;

composer.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@
99
"codeigniter4/framework": "^4"
1010
},
1111
"require-dev": {
12+
"fzaninotto/faker": "^1.9@dev",
1213
"mikey179/vfsstream": "1.6.*",
13-
"phpunit/phpunit": "8.5.*"
14+
"phpunit/phpunit": "^8.5"
1415
},
1516
"autoload-dev": {
1617
"psr-4": {
1718
"Tests\\Support\\": "tests/_support"
1819
}
1920
},
2021
"scripts": {
21-
"test": "phpunit",
2222
"post-update-cmd": [
2323
"@composer dump-autoload"
24-
]
24+
],
25+
"test": "phpunit"
2526
},
2627
"support": {
2728
"forum": "http://forum.codeigniter.com/",

0 commit comments

Comments
 (0)