Skip to content

Commit 90f9eed

Browse files
committed
Release v4.7.1
1 parent e7753bc commit 90f9eed

37 files changed

+622
-183
lines changed

.github/workflows/close-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99

1010
jobs:
1111
main:
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-24.04
1313
steps:
1414
- name: Close PR with nice message
1515
run: gh pr close ${{ env.ISSUE }} -c "${{ env.COMMENT }}"

.gitignore

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,38 +48,38 @@ Vagrantfile
4848
#-------------------------
4949
# Temporary Files
5050
#-------------------------
51-
writable/cache/*
52-
!writable/cache/index.html
51+
/writable/cache/*
52+
!/writable/cache/index.html
5353

54-
writable/logs/*
55-
!writable/logs/index.html
54+
/writable/logs/*
55+
!/writable/logs/index.html
5656

57-
writable/session/*
58-
!writable/session/index.html
57+
/writable/session/*
58+
!/writable/session/index.html
5959

60-
writable/uploads/*
61-
!writable/uploads/index.html
60+
/writable/uploads/*
61+
!/writable/uploads/index.html
6262

63-
writable/debugbar/*
64-
!writable/debugbar/index.html
63+
/writable/debugbar/*
64+
!/writable/debugbar/index.html
6565

6666
php_errors.log
6767

6868
#-------------------------
6969
# User Guide Temp Files
7070
#-------------------------
71-
user_guide_src/build/*
72-
user_guide_src/cilexer/build/*
73-
user_guide_src/cilexer/dist/*
74-
user_guide_src/cilexer/pycilexer.egg-info/*
71+
/user_guide_src/build/*
72+
/user_guide_src/cilexer/build/*
73+
/user_guide_src/cilexer/dist/*
74+
/user_guide_src/cilexer/pycilexer.egg-info/*
7575

7676
#-------------------------
7777
# Test Files
7878
#-------------------------
79-
tests/coverage*
79+
/tests/coverage*
8080

8181
# Don't save phpunit under version control.
82-
phpunit
82+
/phpunit
8383

8484
#-------------------------
8585
# Composer

app/Config/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class Database extends Config
177177
'swapPre' => '',
178178
'encrypt' => false,
179179
'compress' => false,
180-
'strictOn' => false,
180+
'strictOn' => true,
181181
'failover' => [],
182182
'port' => 3306,
183183
'foreignKeys' => true,

app/Config/WorkerMode.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ class WorkerMode
4040
'cache',
4141
];
4242

43+
/**
44+
* Reset Event Listeners
45+
*
46+
* List of event names whose listeners should be removed between requests.
47+
* Use this if you register event listeners inside other event callbacks
48+
* (rather than at the top level of Config/Events.php), which would cause
49+
* them to accumulate across requests in worker mode.
50+
*
51+
* @var list<string>
52+
*/
53+
public array $resetEventListeners = [];
54+
4355
/**
4456
* Force Garbage Collection
4557
*

system/BaseModel.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ abstract public function countAllResults(bool $reset = true, bool $test = false)
582582
* @return void
583583
*
584584
* @throws DataException
585+
* @throws InvalidArgumentException if $size is not a positive integer
585586
*/
586587
abstract public function chunk(int $size, Closure $userFunc);
587588

@@ -1099,15 +1100,35 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
10991100
{
11001101
if (is_array($set)) {
11011102
foreach ($set as &$row) {
1103+
// Save the index value from the original row because
1104+
// transformDataToArray() may strip it when updateOnlyChanged
1105+
// is true.
1106+
$updateIndex = null;
1107+
1108+
if ($this->updateOnlyChanged) {
1109+
if (is_array($row)) {
1110+
$updateIndex = $row[$index] ?? null;
1111+
} elseif ($row instanceof Entity) {
1112+
$updateIndex = $row->toRawArray()[$index] ?? null;
1113+
} elseif (is_object($row)) {
1114+
$updateIndex = $row->{$index} ?? null;
1115+
}
1116+
}
1117+
11021118
$row = $this->transformDataToArray($row, 'update');
11031119

11041120
// Validate data before saving.
11051121
if (! $this->skipValidation && ! $this->validate($row)) {
11061122
return false;
11071123
}
11081124

1109-
// Save updateIndex for later
1110-
$updateIndex = $row[$index] ?? null;
1125+
// When updateOnlyChanged is true, restore the pre-extracted
1126+
// index into $row. Otherwise read it from the transformed row.
1127+
if ($updateIndex !== null) {
1128+
$row[$index] = $updateIndex;
1129+
} else {
1130+
$updateIndex = $row[$index] ?? null;
1131+
}
11111132

11121133
if ($updateIndex === null) {
11131134
throw new InvalidArgumentException(

system/CLI/CLI.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,35 @@ protected static function fwrite($handle, string $string)
11291129
/**
11301130
* Testing purpose only
11311131
*
1132-
* @testTag
1132+
* @internal
1133+
*/
1134+
public static function reset(): void
1135+
{
1136+
static::$initialized = false;
1137+
static::$segments = [];
1138+
static::$options = [];
1139+
static::$lastWrite = null;
1140+
static::$height = null;
1141+
static::$width = null;
1142+
static::$isColored = static::hasColorSupport(STDOUT);
1143+
1144+
static::resetInputOutput();
1145+
}
1146+
1147+
/**
1148+
* Testing purpose only
1149+
*
1150+
* @internal
1151+
*/
1152+
public static function resetLastWrite(): void
1153+
{
1154+
static::$lastWrite = null;
1155+
}
1156+
1157+
/**
1158+
* Testing purpose only
1159+
*
1160+
* @internal
11331161
*/
11341162
public static function setInputOutput(InputOutput $io): void
11351163
{
@@ -1139,7 +1167,7 @@ public static function setInputOutput(InputOutput $io): void
11391167
/**
11401168
* Testing purpose only
11411169
*
1142-
* @testTag
1170+
* @internal
11431171
*/
11441172
public static function resetInputOutput(): void
11451173
{

system/Cache/Handlers/MemcachedHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function initialize(): void
9797
throw new CriticalError('Cache: Not support Memcache(d) extension.');
9898
}
9999
} catch (Exception $e) {
100-
throw new CriticalError('Cache: Memcache(d) connection refused (' . $e->getMessage() . ').');
100+
throw new CriticalError('Cache: Memcache(d) connection refused (' . $e->getMessage() . ').', $e->getCode(), $e);
101101
}
102102
}
103103

system/Cache/Handlers/PredisHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function initialize(): void
7676
$this->redis = new Client($this->config, ['prefix' => $this->prefix]);
7777
$this->redis->time();
7878
} catch (Exception $e) {
79-
throw new CriticalError('Cache: Predis connection refused (' . $e->getMessage() . ').');
79+
throw new CriticalError('Cache: Predis connection refused (' . $e->getMessage() . ').', $e->getCode(), $e);
8080
}
8181
}
8282

system/Cache/Handlers/RedisHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function initialize(): void
9494
throw new CriticalError('Cache: Redis select database failed.');
9595
}
9696
} catch (RedisException $e) {
97-
throw new CriticalError('Cache: RedisException occurred with message (' . $e->getMessage() . ').');
97+
throw new CriticalError('Cache: RedisException occurred with message (' . $e->getMessage() . ').', $e->getCode(), $e);
9898
}
9999
}
100100

system/CodeIgniter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class CodeIgniter
5555
/**
5656
* The current version of CodeIgniter Framework
5757
*/
58-
public const CI_VERSION = '4.7.0';
58+
public const CI_VERSION = '4.7.1';
5959

6060
/**
6161
* App startup time.

0 commit comments

Comments
 (0)