Skip to content

Commit 75d8b56

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.4
2 parents 56dba66 + 621edbe commit 75d8b56

20 files changed

+155
-46
lines changed

.php-cs-fixer.dist.php

+17
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@
4545

4646
$overrides = [
4747
'php_unit_data_provider_return_type' => true,
48+
'no_extra_blank_lines' => [
49+
'tokens' => [
50+
'attribute',
51+
'break',
52+
'case',
53+
'continue',
54+
'curly_brace_block',
55+
'default',
56+
'extra',
57+
'parenthesis_brace_block',
58+
'return',
59+
'square_brace_block',
60+
'switch',
61+
'throw',
62+
'use',
63+
],
64+
],
4865
];
4966

5067
$options = [

.php-cs-fixer.no-header.php

+17
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@
3131

3232
$overrides = [
3333
'php_unit_data_provider_return_type' => true,
34+
'no_extra_blank_lines' => [
35+
'tokens' => [
36+
'attribute',
37+
'break',
38+
'case',
39+
'continue',
40+
'curly_brace_block',
41+
'default',
42+
'extra',
43+
'parenthesis_brace_block',
44+
'return',
45+
'square_brace_block',
46+
'switch',
47+
'throw',
48+
'use',
49+
],
50+
],
3451
];
3552

3653
$options = [

.php-cs-fixer.user-guide.php

+20-1
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
])
2525
->notPath([
2626
'ci3sample/',
27-
'libraries/sessions/016.php',
2827
'database/query_builder/075.php',
28+
'libraries/sessions/016.php',
29+
'outgoing/response/031.php',
30+
'outgoing/response/032.php',
2931
]);
3032

3133
$overrides = [
@@ -34,6 +36,23 @@
3436
'no_unused_imports' => false,
3537
'class_attributes_separation' => false,
3638
'php_unit_data_provider_return_type' => true,
39+
'no_extra_blank_lines' => [
40+
'tokens' => [
41+
'attribute',
42+
'break',
43+
'case',
44+
'continue',
45+
'curly_brace_block',
46+
'default',
47+
'extra',
48+
'parenthesis_brace_block',
49+
'return',
50+
'square_brace_block',
51+
'switch',
52+
'throw',
53+
'use',
54+
],
55+
],
3756
];
3857

3958
$options = [

app/Config/Filters.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Filters extends BaseConfig
5555
*
5656
* If you use this, you should disable auto-routing because auto-routing
5757
* permits any HTTP method to access a controller. Accessing the controller
58-
* with a method you dont expect could bypass the filter.
58+
* with a method you don't expect could bypass the filter.
5959
*/
6060
public array $methods = [];
6161

app/Config/Kint.php

+18
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
namespace Config;
44

55
use CodeIgniter\Config\BaseConfig;
6+
use Kint\Parser\ConstructablePluginInterface;
67
use Kint\Renderer\AbstractRenderer;
8+
use Kint\Renderer\Rich\TabPluginInterface;
9+
use Kint\Renderer\Rich\ValuePluginInterface;
710

811
/**
912
* --------------------------------------------------------------------------
@@ -23,7 +26,12 @@ class Kint extends BaseConfig
2326
|--------------------------------------------------------------------------
2427
*/
2528

29+
/**
30+
* @var array<int, ConstructablePluginInterface|string>
31+
* @phpstan-var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>
32+
*/
2633
public $plugins;
34+
2735
public int $maxDepth = 6;
2836
public bool $displayCalledFrom = true;
2937
public bool $expanded = false;
@@ -36,7 +44,17 @@ class Kint extends BaseConfig
3644
public string $richTheme = 'aante-light.css';
3745
public bool $richFolder = false;
3846
public int $richSort = AbstractRenderer::SORT_FULL;
47+
48+
/**
49+
* @var array<string, string>
50+
* @phpstan-var array<string, class-string<ValuePluginInterface>>
51+
*/
3952
public $richObjectPlugins;
53+
54+
/**
55+
* @var array<string, string>
56+
* @phpstan-var array<string, class-string<TabPluginInterface>>
57+
*/
4058
public $richTabPlugins;
4159

4260
/*

app/Config/Logger.php

-2
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,12 @@ class Logger extends BaseConfig
7474
* the handler on top and continuing down.
7575
*/
7676
public array $handlers = [
77-
7877
/*
7978
* --------------------------------------------------------------------
8079
* File Handler
8180
* --------------------------------------------------------------------
8281
*/
8382
FileHandler::class => [
84-
8583
// The log levels that this handler will handle.
8684
'handles' => [
8785
'critical',

app/Controllers/BaseController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ abstract class BaseController extends Controller
4444
// protected $session;
4545

4646
/**
47-
* Constructor.
47+
* @return void
4848
*/
4949
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
5050
{

app/Controllers/Home.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class Home extends BaseController
66
{
7-
public function index()
7+
public function index(): string
88
{
99
return view('welcome_message');
1010
}

changelogs/CHANGELOG_4.0.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ These changes increase security when handling uploaded files as the client can n
515515
- Add hex2bin prefix handling for encryption key [\#3307](https://github.com/codeigniter4/CodeIgniter4/pull/3307) ([michalsn](https://github.com/michalsn))
516516
- add break; in foreach at Time::getDst\(\) when daylightSaving set [\#3305](https://github.com/codeigniter4/CodeIgniter4/pull/3305) ([samsonasik](https://github.com/samsonasik))
517517
- New command: cache:clear [\#3304](https://github.com/codeigniter4/CodeIgniter4/pull/3304) ([lonnieezell](https://github.com/lonnieezell))
518-
- force\_https didnt force https [\#3302](https://github.com/codeigniter4/CodeIgniter4/pull/3302) ([colethorsen](https://github.com/colethorsen))
518+
- force\_https didn't force https [\#3302](https://github.com/codeigniter4/CodeIgniter4/pull/3302) ([colethorsen](https://github.com/colethorsen))
519519
- add test for CommandRunner::\_remap\(\) with empty first params [\#3301](https://github.com/codeigniter4/CodeIgniter4/pull/3301) ([samsonasik](https://github.com/samsonasik))
520520
- FieldData -\> add typeName field and length field [\#3299](https://github.com/codeigniter4/CodeIgniter4/pull/3299) ([devorama](https://github.com/devorama))
521521
- reduce repetitive getDefaultNamespace\(\) and controllerName\(\) function call in Router [\#3298](https://github.com/codeigniter4/CodeIgniter4/pull/3298) ([samsonasik](https://github.com/samsonasik))
@@ -2380,7 +2380,7 @@ These changes increase security when handling uploaded files as the client can n
23802380
- Database can't save connect instances because var "$group" default is NULL [\#466](https://github.com/codeigniter4/CodeIgniter4/issues/466)
23812381
- redirect\(\) issue [\#465](https://github.com/codeigniter4/CodeIgniter4/issues/465)
23822382
- Join not working in Query Builder [\#464](https://github.com/codeigniter4/CodeIgniter4/issues/464)
2383-
- If the controllers method's parameter has a default value , the program will show 500 error [\#461](https://github.com/codeigniter4/CodeIgniter4/issues/461)
2383+
- If the controller's method's parameter has a default value , the program will show 500 error [\#461](https://github.com/codeigniter4/CodeIgniter4/issues/461)
23842384
- Wrong ROOTPATH on console [\#460](https://github.com/codeigniter4/CodeIgniter4/issues/460)
23852385
- Rename "public" Folder Not Working [\#453](https://github.com/codeigniter4/CodeIgniter4/issues/453)
23862386
- Environment File [\#452](https://github.com/codeigniter4/CodeIgniter4/issues/452)

contributing/pull_request.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Before we look into how to contribute to CodeIgniter4, here are some guidelines.
2828
Your Pull Requests (PRs) need to meet our guidelines.
2929

3030
If your Pull Requests fail to pass these guidelines, they will be declined,
31-
and you will need to re-submit when youve made the changes.
31+
and you will need to re-submit when you've made the changes.
3232
This might sound a bit tough, but it is required for us to maintain the quality of the codebase.
3333

3434
### PHP Style

phpstan-baseline.php

-25
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,6 @@
11
<?php declare(strict_types = 1);
22

33
$ignoreErrors = [];
4-
$ignoreErrors[] = [
5-
'message' => '#^Property Config\\\\Kint\\:\\:\\$plugins has no type specified\\.$#',
6-
'count' => 1,
7-
'path' => __DIR__ . '/app/Config/Kint.php',
8-
];
9-
$ignoreErrors[] = [
10-
'message' => '#^Property Config\\\\Kint\\:\\:\\$richObjectPlugins has no type specified\\.$#',
11-
'count' => 1,
12-
'path' => __DIR__ . '/app/Config/Kint.php',
13-
];
14-
$ignoreErrors[] = [
15-
'message' => '#^Property Config\\\\Kint\\:\\:\\$richTabPlugins has no type specified\\.$#',
16-
'count' => 1,
17-
'path' => __DIR__ . '/app/Config/Kint.php',
18-
];
19-
$ignoreErrors[] = [
20-
'message' => '#^Method App\\\\Controllers\\\\BaseController\\:\\:initController\\(\\) has no return type specified\\.$#',
21-
'count' => 1,
22-
'path' => __DIR__ . '/app/Controllers/BaseController.php',
23-
];
24-
$ignoreErrors[] = [
25-
'message' => '#^Method App\\\\Controllers\\\\Home\\:\\:index\\(\\) has no return type specified\\.$#',
26-
'count' => 1,
27-
'path' => __DIR__ . '/app/Controllers/Home.php',
28-
];
294
$ignoreErrors[] = [
305
'message' => '#^Method CodeIgniter\\\\Autoloader\\\\Autoloader\\:\\:discoverComposerNamespaces\\(\\) has no return type specified\\.$#',
316
'count' => 1,

system/Database/OCI8/Forge.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ protected function _attributeAutoIncrement(array &$attributes, array &$field)
187187
protected function _processColumn(array $field): string
188188
{
189189
$constraint = '';
190-
// @todo: cant cover multi pattern when set type.
190+
// @todo: can't cover multi pattern when set type.
191191
if ($field['type'] === 'VARCHAR2' && strpos($field['length'], "('") === 0) {
192192
$constraint = ' CHECK(' . $this->db->escapeIdentifiers($field['name'])
193193
. ' IN ' . $field['length'] . ')';

system/HTTP/ContentSecurityPolicy.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public function reportOnly(bool $value = true)
327327
/**
328328
* Adds a new base_uri value. Can be either a URI class or a simple string.
329329
*
330-
* base_uri restricts the URLs that can appear in a pages <base> element.
330+
* base_uri restricts the URLs that can appear in a page's <base> element.
331331
*
332332
* @see http://www.w3.org/TR/CSP/#directive-base-uri
333333
*

tests/system/Database/Live/OCI8/CallStoredProcedureTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public function testCallPackageProcedure()
5151
'name' => ':output',
5252
'value' => &$result,
5353
],
54-
5554
]);
5655

5756
$this->assertSame($result, '7');
@@ -74,7 +73,6 @@ public function testCallStoredProcedure()
7473
'name' => ':output',
7574
'value' => &$result,
7675
],
77-
7876
]);
7977

8078
$this->assertSame($result, '7');
@@ -90,7 +88,6 @@ public function testCallStoredProcedureForCursor()
9088
'type' => OCI_B_CURSOR,
9189
'value' => &$result,
9290
],
93-
9491
]);
9592

9693
oci_execute($result);

tests/system/Database/Live/UpdateTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ public function testUpdateBatchUpdateFieldsAndAlias()
342342
'country' => 'Greece',
343343
],
344344
[
345-
346345
'email' => '[email protected]',
347346
'name' => 'Ahmadinejad No change',
348347
'country' => 'Greece',

tests/system/Database/Live/UpsertTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,8 @@ public function testUpsertAndUpsertBatchWithObject()
9898
break;
9999

100100
case 'Postgre':
101-
102101
case 'SQLite3':
103-
104102
case 'SQLSRV':
105-
106103
case 'OCI8':
107104
// postgre, sqlite, sqlsrv, oracle - counts row with no change
108105
$this->assertSame(3, $affectedRows1);

tests/system/Test/TestCaseTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use CodeIgniter\CLI\CLI;
1515
use CodeIgniter\Events\Events;
1616
use CodeIgniter\HTTP\Response;
17-
1817
use Config\App;
1918

2019
/**

user_guide_src/source/installation/running.rst

+73
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,86 @@ The above configuration assumes the project folder is located as follows:
182182
│ └── public/ (DocumentRoot for myproject.local)
183183
└── htdocs/
184184
185+
Restart Apache.
186+
185187
Testing
186188
-------
187189

188190
With the above configuration, your webapp would be accessed with the URL **http://myproject.local/** in your browser.
189191

190192
Apache needs to be restarted whenever you change its configuration.
191193

194+
Hosting with Subfolder
195+
======================
196+
197+
If you want a baseURL like **http://localhost/myproject/** with a subfolder,
198+
there are three ways.
199+
200+
Making Symlink
201+
--------------
202+
203+
Place your project folder as follows, where **htdocs** is the Apache document root::
204+
205+
├── myproject/ (project folder)
206+
│ └── public/
207+
└── htdocs/
208+
209+
Navigate to the **htdocs** folder and create a symbolic link as follows::
210+
211+
> cd htdocs/
212+
> ln -s ../myproject/public/ myproject
213+
214+
Using Alias
215+
-----------
216+
217+
Place your project folder as follows, where **htdocs** is the Apache document root::
218+
219+
├── myproject/ (project folder)
220+
│ └── public/
221+
└── htdocs/
222+
223+
Add the following in the main configuration file, e.g., **apache2/conf/httpd.conf**:
224+
225+
.. code-block:: apache
226+
227+
Alias /myproject /opt/lamp/apache2/myproject/public
228+
<Directory "/opt/lamp/apache2/myproject/public">
229+
AllowOverride All
230+
Require all granted
231+
</Directory>
232+
233+
Restart Apache.
234+
235+
Adding .htaccess
236+
----------------
237+
238+
The last resort is to add **.htaccess** to the project root.
239+
240+
It is not recommended that you place the project folder in the document root.
241+
However, if you have no other choice, like on a shared server, you can use this.
242+
243+
Place your project folder as follows, where **htdocs** is the Apache document root,
244+
and create the **.htaccess** file::
245+
246+
└── htdocs/
247+
└── myproject/ (project folder)
248+
├── .htaccess
249+
└── public/
250+
251+
And edit **.htaccess** as follows:
252+
253+
.. code-block:: apache
254+
255+
<IfModule mod_rewrite.c>
256+
RewriteEngine On
257+
RewriteRule ^(.*)$ public/$1 [L]
258+
</IfModule>
259+
260+
<FilesMatch "^\.">
261+
Require all denied
262+
Satisfy All
263+
</FilesMatch>
264+
192265
Hosting with mod_userdir (Shared Hosts)
193266
=======================================
194267

user_guide_src/source/libraries/sessions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ necessary with our new implementation. However, it may happen that your
416416
application relied on these values, so here are alternative methods of
417417
accessing them:
418418

419-
- session_id: ``$session->session_id`` or ``session_id()`` (PHPs built-in function)
419+
- session_id: ``$session->session_id`` or ``session_id()`` (PHP's built-in function)
420420
- ip_address: ``$_SERVER['REMOTE_ADDR']``
421421
- user_agent: ``$_SERVER['HTTP_USER_AGENT']`` (unused by sessions)
422422
- last_activity: Depends on the storage, no straightforward way. Sorry!

0 commit comments

Comments
 (0)