Skip to content

Commit 60f1e8e

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.3
Conflicts: composer.json
2 parents dbc523f + b549c44 commit 60f1e8e

File tree

10 files changed

+51
-33
lines changed

10 files changed

+51
-33
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
## What is CodeIgniter?
1313

1414
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure.
15-
More information can be found at the [official site](http://codeigniter.com).
15+
More information can be found at the [official site](https://codeigniter.com).
1616

1717
This repository holds the source code for CodeIgniter 4 only.
1818
Version 4 is a complete rewrite to bring the quality and the code into a more modern version,
1919
while still keeping as many of the things intact that has made people love the framework over the years.
2020

21-
More information about the plans for version 4 can be found in [the announcement](http://forum.codeigniter.com/thread-62615.html) on the forums.
21+
More information about the plans for version 4 can be found in [CodeIgniter 4](https://forum.codeigniter.com/forumdisplay.php?fid=28) on the forums.
2222

2323
### Documentation
2424

@@ -69,12 +69,12 @@ to optional packages, with their own repository.
6969

7070
## Contributing
7171

72-
We **are** accepting contributions from the community! It doesn't matter whether you can code, write documentation, or help find bugs,
73-
all contributions are welcome.
72+
We **are** accepting contributions from the community! It doesn't matter whether you can code, write documentation, or help find bugs,
73+
all contributions are welcome.
7474

7575
Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/README.md).
7676

77-
CodeIgniter has had thousands on contributions from people since its creation. This project would not be what it is without them.
77+
CodeIgniter has had thousands on contributions from people since its creation. This project would not be what it is without them.
7878

7979
<a href="https://github.com/codeigniter4/CodeIgniter4/graphs/contributors">
8080
<img src="https://contrib.rocks/image?repo=codeigniter4/CodeIgniter4" />
@@ -86,7 +86,6 @@ Made with [contrib.rocks](https://contrib.rocks).
8686

8787
PHP version 7.4 or higher is required, with the following extensions installed:
8888

89-
9089
- [intl](http://php.net/manual/en/intl.requirements.php)
9190
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library
9291
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
@@ -95,7 +94,7 @@ Additionally, make sure that the following extensions are enabled in your PHP:
9594

9695
- json (enabled by default - don't turn it off)
9796
- xml (enabled by default - don't turn it off)
98-
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php)
97+
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php) if you plan to use MySQL
9998

10099
## Running CodeIgniter Tests
101100

admin/framework/README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
## What is CodeIgniter?
44

55
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure.
6-
More information can be found at the [official site](http://codeigniter.com).
6+
More information can be found at the [official site](https://codeigniter.com).
77

8-
This repository holds the distributable version of the framework,
9-
including the user guide. It has been built from the
8+
This repository holds the distributable version of the framework.
9+
It has been built from the
1010
[development repository](https://github.com/codeigniter4/CodeIgniter4).
1111

12-
More information about the plans for version 4 can be found in [the announcement](http://forum.codeigniter.com/thread-62615.html) on the forums.
12+
More information about the plans for version 4 can be found in [CodeIgniter 4](https://forum.codeigniter.com/forumdisplay.php?fid=28) on the forums.
1313

14-
The user guide corresponding to this version of the framework can be found
14+
The user guide corresponding to the latest version of the framework can be found
1515
[here](https://codeigniter4.github.io/userguide/).
1616

17-
1817
## Important Change with index.php
1918

2019
`index.php` is no longer in the root of the project! It has been moved inside the *public* folder,
@@ -47,10 +46,10 @@ PHP version 7.4 or higher is required, with the following extensions installed:
4746

4847
- [intl](http://php.net/manual/en/intl.requirements.php)
4948
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library
49+
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
5050

5151
Additionally, make sure that the following extensions are enabled in your PHP:
5252

5353
- json (enabled by default - don't turn it off)
54-
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
55-
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php)
5654
- xml (enabled by default - don't turn it off)
55+
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php) if you plan to use MySQL

admin/framework/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"test": "phpunit"
5858
},
5959
"support": {
60-
"forum": "http://forum.codeigniter.com/",
60+
"forum": "https://forum.codeigniter.com/",
6161
"source": "https://github.com/codeigniter4/CodeIgniter4",
6262
"slack": "https://codeigniterchat.slack.com"
6363
}

admin/starter/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
## What is CodeIgniter?
44

55
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure.
6-
More information can be found at the [official site](http://codeigniter.com).
6+
More information can be found at the [official site](https://codeigniter.com).
77

88
This repository holds a composer-installable app starter.
99
It has been built from the
1010
[development repository](https://github.com/codeigniter4/CodeIgniter4).
1111

12-
More information about the plans for version 4 can be found in [the announcement](http://forum.codeigniter.com/thread-62615.html) on the forums.
12+
More information about the plans for version 4 can be found in [CodeIgniter 4](https://forum.codeigniter.com/forumdisplay.php?fid=28) on the forums.
1313

14-
The user guide corresponding to this version of the framework can be found
14+
The user guide corresponding to the latest version of the framework can be found
1515
[here](https://codeigniter4.github.io/userguide/).
1616

1717
## Installation & updates
@@ -54,10 +54,10 @@ PHP version 7.4 or higher is required, with the following extensions installed:
5454

5555
- [intl](http://php.net/manual/en/intl.requirements.php)
5656
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library
57+
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
5758

5859
Additionally, make sure that the following extensions are enabled in your PHP:
5960

6061
- json (enabled by default - don't turn it off)
61-
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
62-
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php)
6362
- xml (enabled by default - don't turn it off)
63+
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php) if you plan to use MySQL

admin/starter/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"test": "phpunit"
3131
},
3232
"support": {
33-
"forum": "http://forum.codeigniter.com/",
33+
"forum": "https://forum.codeigniter.com/",
3434
"source": "https://github.com/codeigniter4/CodeIgniter4",
3535
"slack": "https://codeigniterchat.slack.com"
3636
}

admin/userguide/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"codeigniter4/framework": "^4"
1010
},
1111
"support": {
12-
"forum": "http://forum.codeigniter.com/",
12+
"forum": "https://forum.codeigniter.com/",
1313
"source": "https://github.com/codeigniter4/CodeIgniter4",
1414
"slack": "https://codeigniterchat.slack.com"
1515
}

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"phpunit/phpcov": "^8.2",
2727
"phpunit/phpunit": "^9.1",
2828
"predis/predis": "^1.1 || ^2.0",
29-
"rector/rector": "0.14.6",
29+
"rector/rector": "0.14.7",
3030
"vimeo/psalm": "^4.26"
3131
},
3232
"suggest": {
@@ -103,7 +103,7 @@
103103
"cs-fix": "Fix the coding style"
104104
},
105105
"support": {
106-
"forum": "http://forum.codeigniter.com/",
106+
"forum": "https://forum.codeigniter.com/",
107107
"source": "https://github.com/codeigniter4/CodeIgniter4",
108108
"slack": "https://codeigniterchat.slack.com"
109109
}

system/Log/Logger.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,9 @@ protected function interpolate($message, array $context = [])
349349
if (strpos($message, 'env:') !== false) {
350350
preg_match('/env:[^}]+/', $message, $matches);
351351

352-
if ($matches) {
353-
foreach ($matches as $str) {
354-
$key = str_replace('env:', '', $str);
355-
$replace["{{$str}}"] = $_ENV[$key] ?? 'n/a';
356-
}
352+
foreach ($matches as $str) {
353+
$key = str_replace('env:', '', $str);
354+
$replace["{{$str}}"] = $_ENV[$key] ?? 'n/a';
357355
}
358356
}
359357

system/Model.php

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ class Model extends BaseModel
118118
*/
119119
protected $escape = [];
120120

121+
/**
122+
* Primary Key value when inserting and useAutoIncrement is false.
123+
*
124+
* @var int|string|null
125+
*/
126+
private $tempPrimaryKeyValue;
127+
121128
/**
122129
* Builder method names that should not be used in the Model.
123130
*
@@ -263,6 +270,13 @@ protected function doInsert(array $data)
263270
$escape = $this->escape;
264271
$this->escape = [];
265272

273+
// If $useAutoIncrement is false, add the primary key data.
274+
if ($this->useAutoIncrement === false && $this->tempPrimaryKeyValue !== null) {
275+
$data[$this->primaryKey] = $this->tempPrimaryKeyValue;
276+
277+
$this->tempPrimaryKeyValue = null;
278+
}
279+
266280
// Require non-empty primaryKey when
267281
// not using auto-increment feature
268282
if (! $this->useAutoIncrement && empty($data[$this->primaryKey])) {
@@ -688,6 +702,10 @@ public function insert($data = null, bool $returnID = true)
688702
}
689703
}
690704

705+
if ($this->useAutoIncrement === false && isset($data[$this->primaryKey])) {
706+
$this->tempPrimaryKeyValue = $data[$this->primaryKey];
707+
}
708+
691709
$this->escape = $this->tempData['escape'] ?? [];
692710
$this->tempData = [];
693711

@@ -737,8 +755,13 @@ protected function objectToRawArray($data, bool $onlyChanged = true, bool $recur
737755

738756
// Always grab the primary key otherwise updates will fail.
739757
if (
740-
method_exists($data, 'toRawArray') && (! empty($properties) && ! empty($this->primaryKey) && ! in_array($this->primaryKey, $properties, true)
741-
&& ! empty($data->{$this->primaryKey}))
758+
method_exists($data, 'toRawArray')
759+
&& (
760+
! empty($properties)
761+
&& ! empty($this->primaryKey)
762+
&& ! in_array($this->primaryKey, $properties, true)
763+
&& ! empty($data->{$this->primaryKey})
764+
)
742765
) {
743766
$properties[$this->primaryKey] = $data->{$this->primaryKey};
744767
}

tests/_support/Models/WithoutAutoIncrementModel.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class WithoutAutoIncrementModel extends Model
1818
protected $table = 'without_auto_increment';
1919
protected $primaryKey = 'key';
2020
protected $allowedFields = [
21-
'key',
2221
'value',
2322
];
2423
protected $useAutoIncrement = false;

0 commit comments

Comments
 (0)