Skip to content
28 changes: 6 additions & 22 deletions libraries/classes/Engines/Innodb.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php
/**
* The InnoDB storage engine
Expand Down Expand Up @@ -264,7 +264,7 @@
global $dbi;

return '<pre id="pre_innodb_status">' . "\n"
. htmlspecialchars((string) $dbi->fetchValue(

Check failure on line 267 in libraries/classes/Engines/Innodb.php

View workflow job for this annotation

GitHub Actions / analyse-php (7.2)

Ignored error pattern #^Cannot cast mixed to string\.$# in path /home/runner/work/phpmyadmin/phpmyadmin/libraries/classes/Engines/Innodb.php is expected to occur 2 times, but occurred only 1 time.

Check failure on line 267 in libraries/classes/Engines/Innodb.php

View workflow job for this annotation

GitHub Actions / analyse-php (7.2)

Ignored error pattern #^Cannot call method fetchValue\(\) on mixed\.$# in path /home/runner/work/phpmyadmin/phpmyadmin/libraries/classes/Engines/Innodb.php is expected to occur 4 times, but occurred only 3 times.
'SHOW ENGINE INNODB STATUS;',
'Status'
)) . "\n" . '</pre>' . "\n";
Expand All @@ -281,38 +281,22 @@
return 'innodb-storage-engine';
}

/**
* Gets the InnoDB plugin version number
*
* @return string the version number, or empty if not running as a plugin
*/
public function getInnodbPluginVersion()
{
global $dbi;

return $dbi->fetchValue('SELECT @@innodb_version;') ?: '';
}

/**
* Gets the InnoDB file format
*
* (do not confuse this with phpMyAdmin's storage engine plugins!)
*
* @return string|null the InnoDB file format
*/
public function getInnodbFileFormat(): ?string
public function getInnodbFileFormat()
{
global $dbi;

$value = $dbi->fetchValue("SHOW GLOBAL VARIABLES LIKE 'innodb_file_format';", 1);

if ($value === false) {
// This variable does not exist anymore on MariaDB >= 10.6.0
// This variable does not exist anymore on MySQL >= 8.0.0
return null;
}

return (string) $value;
return

Check failure on line 295 in libraries/classes/Engines/Innodb.php

View workflow job for this annotation

GitHub Actions / analyse-php (7.2)

Method PhpMyAdmin\Engines\Innodb::getInnodbFileFormat() should return string|null but returns mixed.
($dbi->isMariaDB() && $dbi->getVersion() >= 100600)

Check failure on line 296 in libraries/classes/Engines/Innodb.php

View workflow job for this annotation

GitHub Actions / analyse-php (7.2)

Cannot call method isMariaDB() on mixed.

Check failure on line 296 in libraries/classes/Engines/Innodb.php

View workflow job for this annotation

GitHub Actions / analyse-php (7.2)

Cannot call method getVersion() on mixed.
|| ($dbi->isMySql() && $dbi->getVersion() >= 80000)

Check failure on line 297 in libraries/classes/Engines/Innodb.php

View workflow job for this annotation

GitHub Actions / analyse-php (7.2)

Cannot call method isMySql() on mixed.

Check failure on line 297 in libraries/classes/Engines/Innodb.php

View workflow job for this annotation

GitHub Actions / analyse-php (7.2)

Cannot call method getVersion() on mixed.
? ''
: $dbi->fetchValue("SHOW GLOBAL VARIABLES LIKE 'innodb_file_format';", 1);
}

/**
Expand Down
6 changes: 1 addition & 5 deletions libraries/classes/Operations.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
}

// this does not apply to a rename operation
if (! isset($_POST['add_constraints']) || empty($GLOBALS['sql_constraints_query'])) {

Check failure on line 235 in libraries/classes/Operations.php

View workflow job for this annotation

GitHub Actions / analyse-php (7.2)

Ignored error pattern #^Construct empty\(\) is not allowed\. Use more strict comparison\.$# in path /home/runner/work/phpmyadmin/phpmyadmin/libraries/classes/Operations.php is expected to occur 11 times, but occurred only 10 times.
continue;
}

Expand Down Expand Up @@ -519,11 +519,7 @@

/** @var Innodb $innodbEnginePlugin */
$innodbEnginePlugin = StorageEngine::getEngine('Innodb');
$innodbPluginVersion = $innodbEnginePlugin->getInnodbPluginVersion();
$innodb_file_format = '';
if (! empty($innodbPluginVersion)) {
$innodb_file_format = $innodbEnginePlugin->getInnodbFileFormat() ?? '';
}
$innodb_file_format = $innodbEnginePlugin->getInnodbFileFormat();

/**
* Newer MySQL/MariaDB always return empty a.k.a '' on $innodb_file_format otherwise
Expand Down
8 changes: 0 additions & 8 deletions test/classes/Engines/InnodbTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,6 @@ public function testGetMysqlHelpPage(): void
self::assertSame('innodb-storage-engine', $this->object->getMysqlHelpPage());
}

/**
* Test for getInnodbPluginVersion
*/
public function testGetInnodbPluginVersion(): void
{
self::assertSame('1.1.8', $this->object->getInnodbPluginVersion());
}

/**
* Test for supportsFilePerTable
*/
Expand Down
Loading