Skip to content

Commit 0dc12df

Browse files
committed
Fixes
1 parent 51a1e6f commit 0dc12df

File tree

7 files changed

+16
-11
lines changed

7 files changed

+16
-11
lines changed

src/Dashboards/APCu/APCuTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ private function keysTreeView(array $keys): array {
256256
$path = '';
257257

258258
foreach ($parts as $i => $part) {
259-
$path = $path ? $path.$separator.$part : $part;
259+
$path = $path !== '' && $path !== '0' ? $path.$separator.$part : $part;
260260

261261
if ($i === count($parts) - 1) { // check last part
262262
$current[] = [

src/Dashboards/Memcached/MemcachedTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ private function keysTreeView(array $keys): array {
278278
$path = '';
279279

280280
foreach ($parts as $i => $part) {
281-
$path = $path ? $path.$separator.$part : $part;
281+
$path = $path !== '' && $path !== '0' ? $path.$separator.$part : $part;
282282

283283
if ($i === count($parts) - 1) { // check last part
284284
$current[] = [

src/Dashboards/Redis/Compatibility/Predis.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function pipelineKeys(array $keys): array {
143143
return [];
144144
}
145145

146-
$results = $this->pipeline(function ($pipe) use ($keys, $script_sha) {
146+
$results = $this->pipeline(function ($pipe) use ($keys, $script_sha): void {
147147
foreach ($keys as $key) {
148148
$pipe->evalsha($script_sha, 1, $key);
149149
}

src/Dashboards/Redis/RedisTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ private function keysTreeView(array $keys): array {
423423
$path = '';
424424

425425
foreach ($parts as $i => $part) {
426-
$path = $path ? $path.$separator.$part : $part;
426+
$path = $path !== '' && $path !== '0' ? $path.$separator.$part : $part;
427427

428428
if ($i === count($parts) - 1) { // check last part
429429
$current[] = [

src/Dashboards/Redis/RedisTypes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public function store(string $type, string $key, string $value, string $old_valu
154154
$this->redis->sRem($key, $old_value);
155155
$this->redis->sAdd($key, $value);
156156
}
157+
157158
break;
158159
case 'list':
159160
$size = $this->redis->lLen($key);
@@ -169,6 +170,7 @@ public function store(string $type, string $key, string $value, string $old_valu
169170
Http::stopRedirect();
170171
Helpers::alert($this->template, 'Out of bounds index.', 'error');
171172
}
173+
172174
break;
173175
case 'zset':
174176
$this->redis->zRem($key, $old_value);

tests/Dashboards/Redis/RedisTestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,11 @@ public function testPipelineKeys(): void {
365365
foreach (['a', 'b', 'c'] as $value) {
366366
$this->dashboard->store('list', 'pu-test-list', $value);
367367
}
368+
368369
foreach (['m1', 'm2', 'm3', 'm4'] as $member) {
369370
$this->dashboard->store('set', 'pu-test-set', $member);
370371
}
372+
371373
foreach (['field1' => 'val1', 'field2' => 'val2'] as $field => $value) {
372374
$this->dashboard->store('hash', 'pu-test-hash', $value, '', ['hash_key' => $field]);
373375
}

tests/HelpersTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,38 +191,39 @@ public function testCountChildren(): void {
191191
$expected = [
192192
[
193193
'type' => 'folder',
194-
'count' => 4,
195194
'children' => [
196195
['type' => 'file'],
197196
['type' => 'file'],
198197
[
199-
'type' => 'folder',
200-
'count' => 2,
198+
'type' => 'folder',
199+
201200
'children' => [
202201
['type' => 'file'],
203202
['type' => 'file'],
204203
],
204+
'count' => 2,
205205
],
206206
],
207+
'count' => 4,
207208
],
208209
['type' => 'file'],
209210
['type' => 'file'],
210211
];
211212

212213
$count = Helpers::countChildren($tree);
213-
$this->assertEquals(6, $count);
214-
$this->assertEquals($expected, $tree);
214+
$this->assertSame(6, $count);
215+
$this->assertSame($expected, $tree);
215216
}
216217

217218
public function testCountChildrenEmpty(): void {
218219
$tree = [];
219220
$count = Helpers::countChildren($tree);
220-
$this->assertEquals(0, $count);
221+
$this->assertSame(0, $count);
221222
}
222223

223224
public function testCountChildrenNoFolders(): void {
224225
$tree = [['type' => 'file'], ['type' => 'file'], ['type' => 'file'],];
225226
$count = Helpers::countChildren($tree);
226-
$this->assertEquals(3, $count);
227+
$this->assertSame(3, $count);
227228
}
228229
}

0 commit comments

Comments
 (0)