Skip to content

Commit 62aac3e

Browse files
committed
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2 parents 880afc9 + 748d489 commit 62aac3e

5 files changed

Lines changed: 15 additions & 10 deletions

File tree

js/src/database/structure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const fetchRealRowCount = function ($target) {
173173
if (response.success) {
174174
// If to update all row counts for a DB.
175175
if (response.real_row_count_all) {
176-
$.each(JSON.parse(response.real_row_count_all),
176+
$.each(response.real_row_count_all,
177177
function (index, table) {
178178
// Update each table row count.
179179
$('table.data td[data-table*="' + table.table + '"]')

phpstan-baseline.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,6 +2765,11 @@ parameters:
27652765
count: 1
27662766
path: src/Controllers/Database/Structure/RealRowCountController.php
27672767

2768+
-
2769+
message: "#^Parameter \\#1 \\$value of static method PhpMyAdmin\\\\Util\\:\\:formatNumber\\(\\) expects float\\|int\\|string, int\\|null given\\.$#"
2770+
count: 1
2771+
path: src/Controllers/Database/Structure/RealRowCountController.php
2772+
27682773
-
27692774
message: "#^Parameter \\#2 \\$db of static method PhpMyAdmin\\\\Util\\:\\:getDbInfo\\(\\) expects string, mixed given\\.$#"
27702775
count: 1

psalm-baseline.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,6 +1603,9 @@
16031603
<PossiblyInvalidCast>
16041604
<code><![CDATA[$parameters['table']]]></code>
16051605
</PossiblyInvalidCast>
1606+
<PossiblyNullArgument occurrences="1">
1607+
<code>$rowCount</code>
1608+
</PossiblyNullArgument>
16061609
</file>
16071610
<file src="src/Controllers/Database/Structure/ReplacePrefixController.php">
16081611
<MixedArgument>

src/Controllers/Database/Structure/RealRowCountController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use PhpMyAdmin\Util;
1818

1919
use function __;
20-
use function json_encode;
2120

2221
/**
2322
* Handles request for real row count on database level view page.
@@ -87,9 +86,9 @@ public function __invoke(ServerRequest $request): void
8786
$rowCount = $this->dbi
8887
->getTable($GLOBALS['db'], $table['TABLE_NAME'])
8988
->getRealRowCountTable();
90-
$realRowCountAll[] = ['table' => $table['TABLE_NAME'], 'row_count' => $rowCount];
89+
$realRowCountAll[] = ['table' => $table['TABLE_NAME'], 'row_count' => Util::formatNumber($rowCount, 0)];
9190
}
9291

93-
$this->response->addJSON(['real_row_count_all' => json_encode($realRowCountAll)]);
92+
$this->response->addJSON(['real_row_count_all' => $realRowCountAll]);
9493
}
9594
}

test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub;
1515
use PHPUnit\Framework\Attributes\CoversClass;
1616

17-
use function json_encode;
18-
1917
#[CoversClass(RealRowCountController::class)]
2018
class RealRowCountControllerTest extends AbstractTestCase
2119
{
@@ -49,11 +47,11 @@ public function testRealRowCount(): void
4947

5048
$json = $response->getJSONResult();
5149
$expected = [
52-
['table' => 'City', 'row_count' => 4079],
53-
['table' => 'Country', 'row_count' => 239],
54-
['table' => 'CountryLanguage', 'row_count' => 984],
50+
['table' => 'City', 'row_count' => '4,079'],
51+
['table' => 'Country', 'row_count' => '239'],
52+
['table' => 'CountryLanguage', 'row_count' => '984'],
5553
];
56-
$this->assertEquals(json_encode($expected), $json['real_row_count_all']);
54+
$this->assertEquals($expected, $json['real_row_count_all']);
5755

5856
$dbiDummy->assertAllSelectsConsumed();
5957
}

0 commit comments

Comments
 (0)