Skip to content

Commit 51d9e40

Browse files
committed
Merge remote-tracking branch 'origin/develop' into 4.4
2 parents 3d90c7e + 00a60e0 commit 51d9e40

File tree

23 files changed

+276
-57
lines changed

23 files changed

+276
-57
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## [v4.3.4](https://github.com/codeigniter4/CodeIgniter4/tree/v4.3.4) (2023-04-27)
4+
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.3.3...v4.3.4)
5+
6+
### Breaking Changes
7+
8+
* fix: redirect status code by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7445
9+
* fix: [SQLite3][Postgres][SQLSRV][OCI8] Forge::modifyColumn() changes NULL constraint incorrectly by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7371
10+
11+
### Fixed Bugs
12+
13+
* fix: view cell cannot locate the auto-generated view file by @sammyskills in https://github.com/codeigniter4/CodeIgniter4/pull/7392
14+
* fix: CURLRequest - clear response headers between requests by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/7398
15+
* fix: [Auto Routing Improved] spark routes shows invalid routes by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7419
16+
* fix: remove $insertID in make:model template by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7443
17+
* fix: add missing 'make:cell' in app/Config/Generators.php by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7458
18+
19+
### Refactoring
20+
21+
* refactor: Security::getPostedToken() by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/7377
22+
323
## [v4.3.3](https://github.com/codeigniter4/CodeIgniter4/tree/v4.3.3) (2023-03-26)
424
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.3.2...v4.3.3)
525

app/Config/Generators.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class Generators extends BaseConfig
2626
* @var array<string, string>
2727
*/
2828
public array $views = [
29+
'make:cell' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php',
2930
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
3031
'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php',
3132
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',

system/CodeIgniter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class CodeIgniter
4747
/**
4848
* The current version of CodeIgniter Framework
4949
*/
50-
public const CI_VERSION = '4.3.3';
50+
public const CI_VERSION = '4.3.4';
5151

5252
/**
5353
* App startup time.

system/Database/Forge.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class Forge
153153
*
154154
* @internal Used for marking nullable fields. Not covered by BC promise.
155155
*/
156-
protected $null = '';
156+
protected $null = 'NULL';
157157

158158
/**
159159
* DEFAULT value representation in CREATE/ALTER TABLE statements
@@ -562,7 +562,7 @@ public function createTable(string $table, bool $ifNotExists = false, array $att
562562
}
563563

564564
/**
565-
* @return string
565+
* @return string SQL string
566566
*
567567
* @deprecated $ifNotExists is no longer used, and will be removed.
568568
*/
@@ -897,13 +897,19 @@ protected function _processFields(bool $createTable = false): array
897897
$this->_attributeDefault($attributes, $field);
898898

899899
if (isset($attributes['NULL'])) {
900+
$nullString = ' ' . $this->null;
901+
900902
if ($attributes['NULL'] === true) {
901-
$field['null'] = empty($this->null) ? '' : ' ' . $this->null;
903+
$field['null'] = empty($this->null) ? '' : $nullString;
904+
} elseif ($attributes['NULL'] === $nullString) {
905+
$field['null'] = $nullString;
906+
} elseif ($attributes['NULL'] === '') {
907+
$field['null'] = '';
902908
} else {
903-
$field['null'] = ' NOT NULL';
909+
$field['null'] = ' NOT ' . $this->null;
904910
}
905911
} elseif ($createTable === true) {
906-
$field['null'] = ' NOT NULL';
912+
$field['null'] = ' NOT ' . $this->null;
907913
}
908914

909915
$this->_attributeAutoIncrement($attributes, $field);

system/Database/OCI8/Forge.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,17 @@ protected function _alterTable(string $alterType, string $table, $field)
120120
// If a null constraint is added to a column with a null constraint,
121121
// ORA-01451 will occur,
122122
// so add null constraint is used only when it is different from the current null constraint.
123-
$isWantToAddNull = strpos($field[$i]['null'], ' NOT') === false;
124-
$currentNullAddable = $nullableMap[$field[$i]['name']];
123+
// If a not null constraint is added to a column with a not null constraint,
124+
// ORA-01442 will occur.
125+
$wantToAddNull = strpos($field[$i]['null'], ' NOT') === false;
126+
$currentNullable = $nullableMap[$field[$i]['name']];
125127

126-
if ($isWantToAddNull === $currentNullAddable) {
128+
if ($wantToAddNull === true && $currentNullable === true) {
129+
$field[$i]['null'] = '';
130+
} elseif ($field[$i]['null'] === '' && $currentNullable === false) {
131+
// Nullable by default
132+
$field[$i]['null'] = ' NULL';
133+
} elseif ($wantToAddNull === false && $currentNullable === false) {
127134
$field[$i]['null'] = '';
128135
}
129136
}

system/Database/Postgre/Forge.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,12 @@ protected function _alterTable(string $alterType, string $table, $field)
109109
. " SET DEFAULT {$data['default']}";
110110
}
111111

112-
if (isset($data['null'])) {
113-
$sqls[] = $sql . ' ALTER COLUMN ' . $this->db->escapeIdentifiers($data['name'])
114-
. ($data['null'] === true ? ' DROP' : ' SET') . ' NOT NULL';
112+
$nullable = true; // Nullable by default.
113+
if (isset($data['null']) && ($data['null'] === false || $data['null'] === ' NOT ' . $this->null)) {
114+
$nullable = false;
115115
}
116+
$sqls[] = $sql . ' ALTER COLUMN ' . $this->db->escapeIdentifiers($data['name'])
117+
. ($nullable === true ? ' DROP' : ' SET') . ' NOT NULL';
116118

117119
if (! empty($data['new_name'])) {
118120
$sqls[] = $sql . ' RENAME COLUMN ' . $this->db->escapeIdentifiers($data['name'])

system/Database/SQLSRV/Forge.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,12 @@ protected function _alterTable(string $alterType, string $table, $field)
203203
. " DEFAULT {$data['default']} FOR " . $this->db->escapeIdentifiers($data['name']);
204204
}
205205

206-
if (isset($data['null'])) {
207-
$sqls[] = $sql . ' ALTER COLUMN ' . $this->db->escapeIdentifiers($data['name'])
208-
. ($data['null'] === true ? ' DROP' : '') . " {$data['type']}{$data['length']} NOT NULL";
206+
$nullable = true; // Nullable by default.
207+
if (isset($data['null']) && ($data['null'] === false || $data['null'] === ' NOT ' . $this->null)) {
208+
$nullable = false;
209209
}
210+
$sqls[] = $sql . ' ALTER COLUMN ' . $this->db->escapeIdentifiers($data['name'])
211+
. " {$data['type']}{$data['length']} " . ($nullable === true ? '' : 'NOT') . ' NULL';
210212

211213
if (! empty($data['comment'])) {
212214
$sqls[] = 'EXEC sys.sp_addextendedproperty '

system/Database/SQLite3/Table.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,14 @@ public function dropColumn($columns)
183183
*
184184
* @return Table
185185
*/
186-
public function modifyColumn(array $field)
186+
public function modifyColumn(array $fields)
187187
{
188-
$field = $field[0];
189-
190-
$oldName = $field['name'];
191-
unset($field['name']);
188+
foreach ($fields as $field) {
189+
$oldName = $field['name'];
190+
unset($field['name']);
192191

193-
$this->fields[$oldName] = $field;
192+
$this->fields[$oldName] = $field;
193+
}
194194

195195
return $this;
196196
}

system/Format/JSONFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class JSONFormatter implements FormatterInterface
2222
/**
2323
* Takes the given data and formats it.
2424
*
25-
* @param mixed $data
25+
* @param array|bool|float|int|object|string|null $data
2626
*
2727
* @return false|string (JSON string | false)
2828
*/

system/Format/XMLFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class XMLFormatter implements FormatterInterface
2323
/**
2424
* Takes the given data and formats it.
2525
*
26-
* @param mixed $data
26+
* @param array|bool|float|int|object|string|null $data
2727
*
2828
* @return false|string (XML string | false)
2929
*/

0 commit comments

Comments
 (0)