Skip to content

Commit 4b147f8

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.5
2 parents 2968e1f + bc0517f commit 4b147f8

File tree

11 files changed

+56
-19
lines changed

11 files changed

+56
-19
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"phpunit/phpcov": "^8.2",
3333
"phpunit/phpunit": "^9.1",
3434
"predis/predis": "^1.1 || ^2.0",
35-
"rector/rector": "1.0.0",
35+
"rector/rector": "1.0.1",
3636
"vimeo/psalm": "^5.0"
3737
},
3838
"replace": {

system/BaseModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
* - process various callbacks
4646
* - allow intermingling calls to the db connection
4747
*
48-
* @phpstan-type row_array array<int|string, float|int|null|string>
48+
* @phpstan-type row_array array<int|string, float|int|null|object|string>
4949
* @phpstan-type event_data_beforeinsert array{data: row_array}
5050
* @phpstan-type event_data_afterinsert array{id: int|string, data: row_array, result: bool}
5151
* @phpstan-type event_data_beforefind array{id?: int|string, method: string, singleton: bool, limit?: int, offset?: int}

system/HTTP/CURLRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public function send(string $method, string $url)
380380
// Set the string we want to break our response from
381381
$breakString = "\r\n\r\n";
382382

383-
if (strpos($output, 'HTTP/1.1 100 Continue') === 0) {
383+
while (strpos($output, 'HTTP/1.1 100 Continue') === 0) {
384384
$output = substr($output, strpos($output, $breakString) + 4);
385385
}
386386

tests/system/HTTP/CURLRequestTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,4 +1111,30 @@ public function testUserAgentOption(): void
11111111
$this->assertArrayHasKey(CURLOPT_USERAGENT, $options);
11121112
$this->assertSame($agent, $options[CURLOPT_USERAGENT]);
11131113
}
1114+
1115+
/**
1116+
* @see https://github.com/codeigniter4/CodeIgniter4/issues/8347
1117+
*/
1118+
public function testMultipleHTTP100(): void
1119+
{
1120+
$jsonBody = '{"name":"John Doe","age":30}';
1121+
1122+
$output = "HTTP/1.1 100 Continue
1123+
Mark bundle as not supporting multiuse
1124+
HTTP/1.1 100 Continue
1125+
Mark bundle as not supporting multiuse
1126+
HTTP/1.1 200 OK
1127+
Server: Werkzeug/2.2.2 Python/3.7.17
1128+
Date: Sun, 28 Jan 2024 06:05:36 GMT
1129+
Content-Type: application/json
1130+
Content-Length: 33\r\n\r\n" . $jsonBody;
1131+
1132+
$this->request->setOutput($output);
1133+
1134+
$response = $this->request->request('GET', 'http://example.com');
1135+
1136+
$this->assertSame($jsonBody, $response->getBody());
1137+
1138+
$this->assertSame(200, $response->getStatusCode());
1139+
}
11141140
}

user_guide_src/source/installation/upgrade_file_upload/001.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function index()
1111

1212
public function do_upload()
1313
{
14-
$this->validate([
14+
$this->validateData([], [
1515
'userfile' => [
1616
'uploaded[userfile]',
1717
'max_size[userfile,100]',

user_guide_src/source/installation/upgrade_validations.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ Upgrade Guide
3535

3636
2. Within the controller you have to change the following:
3737

38-
- ``$this->load->helper(array('form', 'url'));`` to ``helper(['form', 'url']);``
38+
- ``$this->load->helper(array('form', 'url'));`` to ``helper('form');``
3939
- remove the line ``$this->load->library('form_validation');``
40-
- ``if ($this->form_validation->run() == FALSE)`` to ``if (! $this->validate([]))``
40+
- ``if ($this->form_validation->run() == FALSE)`` to ``if (! $this->validateData($data, $rules))``
41+
where ``$data`` is the data to validate, typically, the POST data ``$this->request->getPost()``.
4142
- ``$this->load->view('myform');`` to ``return view('myform', ['validation' => $this->validator,]);``
4243

4344
3. You have to change the validation rules. The new syntax is to set the rules as array in the controller:

user_guide_src/source/installation/upgrade_validations/001.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
$isValid = $this->validate([
3+
$isValid = $this->validateData($data, [
44
'name' => 'required|min_length[3]',
55
'email' => 'required|valid_email',
66
'phone' => 'required|numeric|max_length[10]',

user_guide_src/source/installation/upgrade_validations/002.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ class Form extends Controller
88
{
99
public function index()
1010
{
11-
helper(['form', 'url']);
11+
helper('form');
1212

13-
if (! $this->validate([
13+
$data = $this->request->getPost();
14+
15+
if (! $this->validateData($data, [
1416
// Validation rules
1517
])) {
1618
return view('myform');

user_guide_src/source/intro/index.rst

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@
22
Welcome to CodeIgniter4
33
#######################
44

5-
CodeIgniter is an Application Development Framework - a toolkit - for
5+
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and
6+
secure.
7+
8+
It is an Application Development Framework - a toolkit - for
69
people who build web sites using PHP. Its goal is to enable you to
710
develop projects much faster than you could if you were writing code
811
from scratch, by providing a rich set of libraries for commonly needed
912
tasks, as well as a simple interface and logical structure to access
10-
these libraries. CodeIgniter lets you creatively focus on your project
11-
by minimizing the amount of code needed for a given task.
13+
these libraries.
14+
15+
CodeIgniter lets you creatively focus on your project by minimizing the amount
16+
of code needed for a given task.
1217

1318
Where possible, CodeIgniter has been kept as flexible as possible,
1419
allowing you to work in the way you want, not being forced into working
1520
any certain way. The framework can have core parts easily extended
1621
or completely replaced to make the system work the way you need it to.
17-
In short, CodeIgniter is the malleable framework that tries to provide
18-
the tools you need while staying out of the way.
22+
23+
In short, CodeIgniter is the malleable framework that tries to provide the tools
24+
you need while staying out of the way.
1925

2026
*****************************
2127
Is CodeIgniter Right for You?
@@ -25,12 +31,14 @@ CodeIgniter is right for you if:
2531

2632
- You want a framework with a small footprint.
2733
- You need exceptional performance.
34+
- You want a framework that incorporates a number of features and techniques to
35+
enable you to do good security practices easily.
36+
- You want a non-magical framework that you can easily find and read the source
37+
code.
2838
- You want a framework that requires nearly zero configuration.
29-
- You want a framework that does not require you to use the command
30-
line.
3139
- You want a framework that does not require you to adhere to
3240
restrictive coding rules.
33-
- You are not interested in large-scale monolithic libraries like PEAR.
41+
- You want a framework that makes it easy to create test code.
3442
- You do not want to be forced to learn a templating language (although
3543
a template parser is optionally available if you desire one).
3644
- You eschew complexity, favoring simple solutions.

user_guide_src/source/libraries/validation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ file upload related rules::
10491049
<input type="file" name="avatar">
10501050

10511051
// In the controller
1052-
$this->validate([
1052+
$this->validateData([], [
10531053
'avatar' => 'uploaded[avatar]|max_size[avatar,1024]',
10541054
]);
10551055

user_guide_src/source/libraries/validation/045.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// In Controller.
44

5-
if (! $this->validate([
5+
if (! $this->validateData($data, [
66
'username' => 'required',
77
'password' => 'required|min_length[10]',
88
])) {

0 commit comments

Comments
 (0)