We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 754bc1b6 authored by Brion Vibber's avatar Brion Vibber

Error handling cleanup on backup/restore:

* avoid PHP notice from using wrong variable
* show a visible error instead of blank screen if no file submitted with restore form
* avoid PHP strict warning from using calling "non-static" DOMDocument::loadXML statically
* suppress PHP warning from XML parse errors
parent 5abd2b7d
......@@ -95,7 +95,7 @@ class RestoreaccountAction extends Action
function handle($argarray=null)
if ($this->isPost()) {
......@@ -143,6 +143,7 @@ class RestoreaccountAction extends Action
// No file; probably just a non-AJAX submission.
throw new ClientException(_('No uploaded file.'));
// TRANS: Client exception thrown when a temporary folder is not present to store a file upload.
......@@ -185,12 +186,19 @@ class RestoreaccountAction extends Action
// This check is costly but we should probably give
// the user some info ahead of time.
$doc = new DOMDocument();
$doc = DOMDocument::loadXML($xml);
// Disable PHP warnings so we don't spew low-level XML errors to output...
// would be nice if we can just get exceptions instead.
$old_err = error_reporting();
error_reporting($old_err & ~E_WARNING);
$feed = $doc->documentElement;
if ($feed->namespaceURI != Activity::ATOM ||
if (!$feed ||
$feed->namespaceURI != Activity::ATOM ||
$feed->localName != 'feed') {
throw new ClientException(_("Not an atom feed."));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment