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

Get Database structure fails with PHP error on replicated server #15722

Closed
gunnicom opened this issue Dec 30, 2019 · 3 comments
Closed

Get Database structure fails with PHP error on replicated server #15722

gunnicom opened this issue Dec 30, 2019 · 3 comments
Assignees
Labels
Bug A problem or regression with an existing feature
Projects
Milestone

Comments

@gunnicom
Copy link

Describe the bug

When clicking on a database name ( link is like https://DOMAIN/db_structure.php?db=DBNAME )
I get an error and i can not list the tables of that database.
I can show the tables in the treeview on the left. From there i can click on the table.

To Reproduce

Steps to reproduce the behavior:

  1. Go to Start page
  2. Click on Database name in the treeview
  3. See error

Expected behavior

The structure and table names of the database should be shown.

Screenshots

If applicable, add screenshots to help explain your problem.
grafik

Server configuration

  • Operating system: Ubuntu 16.04
  • Web server: Apache 2.4.41
  • Database version: MariaDB 10.2.30
  • PHP version: 7.3.13
  • phpMyAdmin version: 5.0.0

Client configuration

  • Browser: Google Chrome 79
  • Operating system: Windows 7

Additional context

error.log:
[Mon Dec 30 13:41:35.992780 2019] [proxy_fcgi:error] [pid 8824:tid 140017895712512] [client CLIENT_IP:58044] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: strlen() expects parameter 1 to be string, bool given in /var/www/DOMAIN/pma.5.0.0/libraries/classes/Controllers/Database/StructureController.php:770\nStack trace:\n#0 /var/www/DOMAIN/pma.5.0.0/libraries/classes/Controllers/Database/StructureController.php(770): strlen(false)\n#1 /var/www/DOMAIN/pma.5.0.0/libraries/classes/Controllers/Database/StructureController.php(531): PhpMyAdmin\\Controllers\\Database\\StructureController->getReplicationStatus('archived_boepri...')\n#2 /var/www/DOMAIN/pma.5.0.0/libraries/classes/Controllers/Database/StructureController.php(172): PhpMyAdmin\\Controllers\\Database\\StructureController->displayTableList()\n#3 /var/www/DOMAIN/pma.5.0.0/db_structure.php(56): PhpMyAdmin\\Controllers\\Database\\StructureController->index(Array)\n#4 {main}\n thrown in /var/www/DOMAIN/pma.5.0.0/libraries/classes/C...'

@williamdes williamdes added the Bug A problem or regression with an existing feature label Dec 30, 2019
@williamdes williamdes added this to Needs triage in issues via automation Dec 30, 2019
@williamdes williamdes moved this from Needs triage to High priority in issues Dec 30, 2019
@williamdes williamdes added this to the 5.0.1 milestone Dec 30, 2019
@gunnicom
Copy link
Author

Ah, now that i read the error message, it may be related to replication.
I do not have this error on a different server without replication.

@gunnicom
Copy link
Author

gunnicom commented Dec 30, 2019

Quick fix for me is changing libraries/classes/Controllers/Database/StructureController.php lines 770- to:

               $do = ($searchDoDBInTruename!== false && strlen($searchDoDBInTruename) > 0)
                || ($searchDoDBInDB!==false && strlen($searchDoDBInDB) > 0)
                || ($nbServSlaveDoDb == 0 && $nbServSlaveIgnoreDb == 0)
                || $this->hasTable(
                    $GLOBALS['replication_info']['slave']['Wild_Do_Table'],
                    $table
                );

            $searchDb = array_search(
                $this->db,
                $GLOBALS['replication_info']['slave']['Ignore_DB']
            );
            $searchTable = array_search(
                $table,
                $GLOBALS['replication_info']['slave']['Ignore_Table']
            );
            $ignored = ($searchTable!==false && strlen($searchTable) > 0)
                || ($searchDb!==false && strlen($searchDb) > 0)
                || $this->hasTable(
                    $GLOBALS['replication_info']['slave']['Wild_Ignore_Table'],
                    $table
                );

@williamdes williamdes changed the title Get Database structure fails with PHP error Get Database structure fails with PHP error on replicated server Dec 30, 2019
@williamdes williamdes self-assigned this Dec 30, 2019
williamdes added a commit that referenced this issue Dec 30, 2019
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from High priority to Closed Dec 30, 2019
@williamdes
Copy link
Member

Thank you for the report @gunnicom !
I used part of your fix :)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 30, 2020
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
issues
  
Closed
Development

No branches or pull requests

2 participants