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

Downloading a database with GZIP compression from PhpMyAdmin returns uncompressed files #17413

Open
Zio3D opened this issue Feb 21, 2022 · 14 comments
Assignees
Labels
affects/5.2 This issue or pull-request affects 5.2.x releases (and maybe further versions) Bug A problem or regression with an existing feature duplicate waiting on upstream Issues blocked by a third-party

Comments

@Zio3D
Copy link

Zio3D commented Feb 21, 2022

Describe the bug

Since version 94.0.2 of Mozilla Firefox (64 bit) for Windows 10 64 bit, exporting a database with GZIP compression from PhpMyAdmin results in an uncompressed text file.
I report this bug to PhpMyAdmin because the ticket "https://bugzilla.mozilla.org/show_bug.cgi?id=1755324" on Firefox guides me to think about a PhpMyAdmin bug.

To Reproduce

Steps to reproduce the behavior:

  1. With "Mozilla Firefox" (version greater than or equal to 94.0.2, for example 97.0.1) go to 'https://demo.phpmyadmin.net/STABLE/'.
  2. On "Username:" field, insert 'root'. Press 'Go'.
  3. Click on a database (for example 'egzamin ') and then in the top bar click 'Export'.
  4. On "Export method:" select "Custom - display all possible options".
  5. On "Compression:" select "gzipped".
  6. Click "Go" at the bottom right of the page.
  7. Save the file and then read with notepad (with notepad++ is more easy), it is result in .SQL format and not in compressed GZIP format.

Expected behavior

The saved file must be a GZIP compressed .SQL file.

Server configuration

Client configuration

  • Browser: Mozilla Firefox 97.0.1
  • Operating system: Windows 10 Pro 21H2 64 bit.

Additional context

As I indicated in "### Describe the bug", I report this bug to PhpMyAdmin because the ticket "https://bugzilla.mozilla.org/show_bug.cgi?id=1755324" on Firefox guides me to think about a PhpMyAdmin bug.
It is strange that with the previous versions of Mozilla Firefox 94.0.2 the export worked correctly.

Thanks.

@williamdes
Copy link
Member

Hi @Zio3D
I am thinking this could be related to #16042
Could you check ?

@Zio3D
Copy link
Author

Zio3D commented Feb 21, 2022

Hi @williamdes,
it is not related to #16042 as the file I downloaded is entirely in .SQL format.

@Zio3D
Copy link
Author

Zio3D commented Feb 21, 2022

I had my problems on "mysql.aruba.it".
Database Server:

  • Server type: Percona Server
  • Server version: 5.5.62-38.14-log - Percona Server (GPL), Release 38.14, Revision 7e0e1cc
  • Protocol version: 10

With the test server "https://demo.phpmyadmin.net/STABLE" I have same problem but it only exports the first 74,824 Bytes.

@liviuconcioiu
Copy link
Contributor

liviuconcioiu commented Feb 21, 2022

I can confirm what @Zio3D says. It exports only ~73 Kb (SQL only) and nothing else. Changing application/x-gzip with application/octet-stream fixes the problem.

Isn't possible to check if Firefox is present in user agent string and change $mediaType accordingly? Even if is a browser bug.

As a matter of fact, even zip doesn't work for me. It exports only 136 bytes (zipped).

Server configuration

  • Operating system: Windows 10
  • Web server: nginx/1.21.6
  • Database version: 5.7.37 - MySQL Community Server (GPL)
  • PHP version: 8.1.3
  • phpMyAdmin version: 5.3.0-dev

Client configuration

  • Browser: Firefox 99.0a1 (Nightly)
  • Operating system: Windows 10

@williamdes
Copy link
Member

Thanks for your comments, so this is a duplicate of #16042, right ?

@liviuconcioiu
Copy link
Contributor

Thanks for your comments, so this is a duplicate of #16042, right ?

Yes.

@williamdes
Copy link
Member

Duplicate of #16042

@williamdes williamdes marked this as a duplicate of #16042 Feb 21, 2022
@williamdes williamdes self-assigned this Feb 21, 2022
@williamdes williamdes added Bug A problem or regression with an existing feature duplicate waiting on upstream Issues blocked by a third-party labels Feb 21, 2022
@Zio3D
Copy link
Author

Zio3D commented Feb 21, 2022

@williamdes , can you reopen this issue?
This is not a duplicate of #16042.
Perhaps for @liviuconcioiu it is a duplicate. For me it remains a non-duplicate issue. On Aruba (mysql.aruba.it) the downloaded file is 500 MB uncompressed instead of the usual 63 MB compressed (GZIP).
Senzanome
Senzanome-1

@williamdes williamdes reopened this Feb 21, 2022
@williamdes
Copy link
Member

Could you try #16042 (comment) just in case ?

@Zio3D
Copy link
Author

Zio3D commented Feb 21, 2022

I'm sorry but I can't do this because the pages are managed by aruba.it.

@ibennetch
Copy link
Member

I've looked in to this quite a bit and have found nothing that clarifies the problem, only makes it more confusing. I'm doing tests with a relatively current master branch and trying a full database export rather than going to a specific table.

With Firefox (97 on a Mac), I confirm that the gzip download is not compressed. The .zip file is a correctly-formed ZIP file, but when uncompressed, the SQL file is empty.

Using Chrome (98 on a Mac), the gzip download is correct, and contains what appears to be a correct representation of the SQL file. The .zip is again correctly-formed, and the uncompressed SQL file is empty.

Using Windows Edge (98 on Windows 11), the gzip and uncompressed SQL appear to be correct.

Changing the mime_type in Export.php causes Firefox to download a correctly formed gzip file that contains the correct SQL file, and it appears to have no negative effect on the Chrome functionality. Based on these tests, it seems to me that we should make the change from x-gzip to octet-stream in the code.

This would require some additional research but https://bugzilla.mozilla.org/show_bug.cgi?id=1755324#c2 seems to me to suggest that there's some ambiguous specification that is causing issues; it isn't immediately clear to me if that's in the phpMyAdmin code or the webserver configuration. It seems Firefox may have changed something relatively recently that shifted this behavior, too.

@maciej-laskowski
Copy link

maciej-laskowski commented Jun 8, 2022

This can also be reproduced using docker. This gives you control over phpmyadmin version and allow to edit its files.

In empty directory create docker-compose.yml file

version: '3.7'

services:
  phpmyadmin:
    image: phpmyadmin:latest
    ports:
      - "8000:80"
    environment:
      MYSQL_USERNAME: root
      MYSQL_ROOT_PASSWORD: root

  db:
    image: mysql:5.7
    command: ["--default-authentication-plugin=mysql_native_password"]
    ports:
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: database
      MYSQL_USER: user
      MYSQL_PASSWORD: password

run docker-compose up -d

go to localhost:8000

@williamdes
Copy link
Member

williamdes commented Jun 9, 2022

I think this was recently resolved, let me know
I would recommend you to docker-compose pull && docker-compose up but before please use the official docker image :) (phpmyadmin/docker#363)

- image: phpmyadmin/phpmyadmin:latest
+ image: phpmyadmin:latest

@maciej-laskowski
Copy link

I think this was recently resolved, let me know I would recommend you to docker-compose pull && docker-compose up but before please use the official docker image :) (phpmyadmin/docker#363)

- image: phpmyadmin/phpmyadmin:latest
+ image: phpmyadmin:latest

I thought I am using an original image 😱 Thanks for the heads-up, I have switched to phpmyadmin:latest in all my projects.

I still get uncompressed file when downloading gzip export from phpmyadmin 5.2.0 on Firefox 101.0 (no issues in Chrome)

@williamdes williamdes added this to the 5.2.1 milestone Jun 9, 2022
@williamdes williamdes added the affects/5.2 This issue or pull-request affects 5.2.x releases (and maybe further versions) label Oct 25, 2022
@williamdes williamdes removed this from the 5.2.1 milestone Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects/5.2 This issue or pull-request affects 5.2.x releases (and maybe further versions) Bug A problem or regression with an existing feature duplicate waiting on upstream Issues blocked by a third-party
Projects
None yet
Development

No branches or pull requests

5 participants