* 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
function handle($argarray=null)
{
function handle($argarray=null)
{
+ parent::handle($argarray);
if ($this->isPost()) {
$this->restoreAccount();
if ($this->isPost()) {
$this->restoreAccount();
return;
case UPLOAD_ERR_NO_FILE:
// No file; probably just a non-AJAX submission.
return;
case UPLOAD_ERR_NO_FILE:
// No file; probably just a non-AJAX submission.
+ throw new ClientException(_('No uploaded file.'));
return;
case UPLOAD_ERR_NO_TMP_DIR:
// TRANS: Client exception thrown when a temporary folder is not present to store a file upload.
return;
case UPLOAD_ERR_NO_TMP_DIR:
// TRANS: Client exception thrown when a temporary folder is not present to store a file upload.
// This check is costly but we should probably give
// the user some info ahead of time.
// 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);
+ $doc->loadXML($xml);
+ error_reporting($old_err);
$feed = $doc->documentElement;
$feed = $doc->documentElement;
- if ($feed->namespaceURI != Activity::ATOM ||
+ if (!$feed ||
+ $feed->namespaceURI != Activity::ATOM ||
$feed->localName != 'feed') {
throw new ClientException(_("Not an atom feed."));
}
$feed->localName != 'feed') {
throw new ClientException(_("Not an atom feed."));
}