Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Parse error in DatabaseInterface.php after updating from 4.9.7 to 4.9.8 #17305

Closed
aartsr opened this issue Jan 22, 2022 · 2 comments
Closed
Assignees
Labels
Bug A problem or regression with an existing feature
Milestone

Comments

@aartsr
Copy link

aartsr commented Jan 22, 2022

Describe the bug

All previous phpmyadmin versions in the 4.9-branch have given no problems on this setup (I've simply reverted back to 4.9.7 for now). Using version 4.9.8 however throws this error: PHP Parse error: syntax error, unexpected '?' in ../phpmyadmin/libraries/classes/DatabaseInterface.php on line 1566. The line in question is $storageDbName = $GLOBALS['cfg']['Server']['pmadb'] ?? '';

Server configuration

Operating system: Debian Jessie
Web server: apache/2.4.10
Database version: MySQL 5.5.62
PHP version: 5.6.40
phpMyAdmin version: 4.9.8

Client configuration

Browsers: Firefox/Chrome/Edge
Operating system: Windows 10

Additional context

/**
* This function checks and initialises the phpMyAdmin configuration
* storage state before it is used into session cache.
*
* @return void
*/
public function initRelationParamsCache()
{
$storageDbName = $GLOBALS['cfg']['Server']['pmadb'] ?? '';
// Use "phpmyadmin" as a default database name to check to keep the behavior consistent
$storageDbName = $storageDbName !== null
&& is_string($storageDbName)
&& $storageDbName !== '' ? $storageDbName : 'phpmyadmin';

    // This will make users not having explicitly listed databases
    // have config values filled by the default phpMyAdmin storage table name values
    $this->relation->fixPmaTables($storageDbName, false);

    // This global will be changed if fixPmaTables did find one valid table
    $storageDbName = $GLOBALS['cfg']['Server']['pmadb'] ?? '';

    // Empty means that until now no pmadb was found eligible
    if (empty($storageDbName)) {
        $this->relation->fixPmaTables($GLOBALS['db'], false);
    }
}
@MauricioFauth
Copy link
Member

Hi @aartsr.
Thank you for reporting this issue. This is a mistake that was introduced when we back-ported a fix into the 4.9.x branch.
As an immediate fix, you can change these lines to:

diff --git a/libraries/classes/DatabaseInterface.php b/libraries/classes/DatabaseInterface.php
index 7ab5d754fb..0edc297cd3 100644
--- a/libraries/classes/DatabaseInterface.php
+++ b/libraries/classes/DatabaseInterface.php
@@ -1563,7 +1563,7 @@ class DatabaseInterface
      */
     public function initRelationParamsCache()
     {
-        $storageDbName = $GLOBALS['cfg']['Server']['pmadb'] ?? '';
+        $storageDbName = isset($GLOBALS['cfg']['Server']['pmadb']) ? $GLOBALS['cfg']['Server']['pmadb'] : '';
         // Use "phpmyadmin" as a default database name to check to keep the behavior consistent
         $storageDbName = $storageDbName !== null
                             && is_string($storageDbName)
@@ -1574,7 +1574,7 @@ class DatabaseInterface
         $this->relation->fixPmaTables($storageDbName, false);
 
         // This global will be changed if fixPmaTables did find one valid table
-        $storageDbName = $GLOBALS['cfg']['Server']['pmadb'] ?? '';
+        $storageDbName = isset($GLOBALS['cfg']['Server']['pmadb']) ? $GLOBALS['cfg']['Server']['pmadb'] : '';
 
         // Empty means that until now no pmadb was found eligible
         if (empty($storageDbName)) {

@MauricioFauth MauricioFauth added the Bug A problem or regression with an existing feature label Jan 22, 2022
MauricioFauth added a commit that referenced this issue Jan 22, 2022
Fixes #17305
Fixes #17306

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
@MauricioFauth MauricioFauth self-assigned this Jan 22, 2022
@MauricioFauth MauricioFauth added this to the 4.9.9 milestone Jan 22, 2022
@aartsr
Copy link
Author

aartsr commented Jan 22, 2022

Thanx for the quick reply/fix.

@aartsr aartsr closed this as completed Jan 22, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants