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

Can't export to .xml on latest 5.0.2 - Error: htmlspecialchars() expects parameter 1 to be string, null given #16062

Closed
pamamolf opened this issue Apr 2, 2020 · 6 comments
Assignees
Labels
Bug A problem or regression with an existing feature
Projects
Milestone

Comments

@pamamolf
Copy link

pamamolf commented Apr 2, 2020

Describe the bug

Export to .xml doesn't work and got an error message ERR_INVALID_RESPONSE on Chrome...

To Reproduce

Steps to reproduce the behavior:
Just try to export anything to .xml

Expected behavior

Export to .xml file.

Screenshots

https://i.postimg.cc/W1yTrPPr/image.png

Server configuration

  • Operating system: Centos 7 64bit
  • Web server:Nginx 1.17.9
  • Database version:MariaDB 10.3.22
  • PHP version: 7.4.4
  • phpMyAdmin version: 5.0.2

Client configuration

  • Browser: Chrome latest
  • Operating system: Windows 10

###Additional info:
[02-Apr-2020 20:51:25 UTC] PHP Fatal error: Uncaught TypeError: htmlspecialchars() expects parameter 1 to be string, null given in /usr/local/nginx/html/mysqladmin/libraries/classes/Plugins/Export/ExportXml.php:315
Stack trace:
#0 /usr/local/nginx/html/mysqladmin/libraries/classes/Plugins/Export/ExportXml.php(315): htmlspecialchars()
#1 /usr/local/nginx/html/mysqladmin/export.php(448): PhpMyAdmin\Plugins\Export\ExportXml->exportHeader()
#2 {main}
thrown in /usr/local/nginx/html/mysqladmin/libraries/classes/Plugins/Export/ExportXml.php on line 315

Thank you

@pamamolf pamamolf changed the title Can't export to .xml on latest 5.0.2 - Error: Can't export to .xml on latest 5.0.2 - Error: htmlspecialchars() expects parameter 1 to be string, null given Apr 2, 2020
@ibennetch
Copy link
Member

ibennetch commented Apr 2, 2020 via email

@williamdes williamdes added the Bug A problem or regression with an existing feature label Apr 2, 2020
@williamdes williamdes added this to Needs triage in issues via automation Apr 2, 2020
@williamdes williamdes added this to the 5.0.3 milestone Apr 2, 2020
@williamdes williamdes added the question Used when we need feedback from the submitter or when the issue is a question about PMA label Apr 2, 2020
@ibennetch
Copy link
Member

The error message you've helpfully provided should be enough for us to fix this, however I can't reproduce it.

The value of $tbl here should be the CREATE statement that gets placed in the <pma:table name... tag, and it's not immediately clear to me why this could be null.

Would you mind exporting an SQL file of the database structure (obscuring any sensitive information) and posting it here so I can check against your specific table structure? Could you also confirm if you're trying to export the complete database or just one table?

@williamdes williamdes removed the question Used when we need feedback from the submitter or when the issue is a question about PMA label Apr 3, 2020
@williamdes
Copy link
Member

Here is my proposal patch, could you test it @pamamolf ?

diff --git a/libraries/classes/Plugins/Export/ExportXml.php b/libraries/classes/Plugins/Export/ExportXml.php
index db85add4e2..7ef348cdc3 100644
--- a/libraries/classes/Plugins/Export/ExportXml.php
+++ b/libraries/classes/Plugins/Export/ExportXml.php
@@ -290,7 +290,7 @@ class ExportXml extends ExportPlugin
                     . Util::backquote($table),
                     0
                 );
-                $tbl = $result[$table][1];
+                $tbl = (string) $result[$table][1];
 
                 $is_view = $GLOBALS['dbi']->getTable($db, $table)
                     ->isView();

@pamamolf
Copy link
Author

pamamolf commented Apr 3, 2020

Yes it works !

Thank you

@pamamolf pamamolf closed this as completed Apr 3, 2020
issues automation moved this from Needs triage to Closed Apr 3, 2020
@williamdes williamdes reopened this Apr 3, 2020
issues automation moved this from Closed to Needs triage Apr 3, 2020
@williamdes
Copy link
Member

Thank you, I will commit it to close this issue :)

@williamdes williamdes self-assigned this Apr 3, 2020
williamdes added a commit that referenced this issue Apr 5, 2020
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from Needs triage to Closed Apr 5, 2020
@williamdes
Copy link
Member

Done as 4f4b86d
Sorry for the delay

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2021
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

3 participants