From 85e5a3b5cebf5a7479779297bfcb50294f3f8725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 11 Jun 2013 14:58:02 +0200 Subject: [PATCH] bug #3645 Better handling of invalid ODS documents --- ChangeLog | 1 + libraries/plugins/import/ImportOds.class.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ca574a3f0..3910837559 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ not set - bug #3964 Import using https does not work - bug Missing removeCRLF option in ExportCsv and ExportExcel plugins - bug #3631 Drop not working Visio schema export. +- bug #3645 Better handling of invalid ODS documents 4.0.3.0 (2013-06-05) - bug #3941 Recent tables list always empty diff --git a/libraries/plugins/import/ImportOds.class.php b/libraries/plugins/import/ImportOds.class.php index 3a85f733b1..5a681e97af 100644 --- a/libraries/plugins/import/ImportOds.class.php +++ b/libraries/plugins/import/ImportOds.class.php @@ -175,8 +175,16 @@ class ImportOds extends ImportPlugin ); $error = true; } else { - $sheets = $xml->children('office', true)->{'body'}->{'spreadsheet'} - ->children('table', true); + $root = $xml->children('office', true)->{'body'}->{'spreadsheet'}; + if (empty($root)) { + $sheets = array(); + $message = PMA_Message::error( + __('Could not parse OpenDocument Spreasheet!') + ); + $error = true; + } else { + $sheets = $root->children('table', true); + } } $tables = array();