summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin_media.php10
-rw-r--r--admin_pgv_to_wt.php7
-rw-r--r--admin_site_upgrade.php12
-rw-r--r--admin_trees_export.php4
-rw-r--r--app/Http/Controllers/AdminController.php3
-rw-r--r--app/Http/Controllers/EditMediaController.php4
-rw-r--r--app/Module/BatchUpdate/BatchUpdateSearchReplacePlugin.php3
7 files changed, 24 insertions, 19 deletions
diff --git a/admin_media.php b/admin_media.php
index ee70842d25..6be247a8a1 100644
--- a/admin_media.php
+++ b/admin_media.php
@@ -15,9 +15,9 @@
*/
namespace Fisharebest\Webtrees;
-use ErrorException;
use Fisharebest\Webtrees\Controller\AjaxController;
use Fisharebest\Webtrees\Controller\PageController;
+use Throwable;
// @TODO MediaFile
require 'includes/session.php';
@@ -60,7 +60,7 @@ if ($delete_file) {
try {
unlink($tmp);
FlashMessages::addMessage(I18N::translate('The file %s has been deleted.', Html::filename($tmp)), 'success');
- } catch (ErrorException $ex) {
+ } catch (Throwable $ex) {
DebugBar::addThrowable($ex);
FlashMessages::addMessage(I18N::translate('The file %s could not be deleted.', Html::filename($tmp)) . '<hr><samp dir="ltr">' . $ex->getMessage() . '</samp>', 'danger');
@@ -71,7 +71,7 @@ if ($delete_file) {
try {
unlink($tmp);
FlashMessages::addMessage(I18N::translate('The file %s has been deleted.', Html::filename($tmp)), 'success');
- } catch (ErrorException $ex) {
+ } catch (Throwable $ex) {
DebugBar::addThrowable($ex);
FlashMessages::addMessage(I18N::translate('The file %s could not be deleted.', Html::filename($tmp)) . '<hr><samp dir="ltr">' . $ex->getMessage() . '</samp>', 'danger');
@@ -495,14 +495,14 @@ function mediaFileInfo($media_folder, $media_path, $file) {
$html .= '<dt>' . I18N::translate('Image dimensions') . '</dt>';
$html .= '<dd>' . /* I18N: image dimensions, width × height */
I18N::translate('%1$s × %2$s pixels', I18N::number($imgsize['0']), I18N::number($imgsize['1'])) . '</dd>';
- } catch (ErrorException $ex) {
+ } catch (Throwable $ex) {
DebugBar::addThrowable($ex);
// Not an image, or not a valid image?
}
$html .= '</dl>';
- } catch (ErrorException $ex) {
+ } catch (Throwable $ex) {
DebugBar::addThrowable($ex);
// Not a file? Not an image?
diff --git a/admin_pgv_to_wt.php b/admin_pgv_to_wt.php
index a528024f78..2b4caf8395 100644
--- a/admin_pgv_to_wt.php
+++ b/admin_pgv_to_wt.php
@@ -18,6 +18,7 @@ namespace Fisharebest\Webtrees;
use Fisharebest\Webtrees\Controller\PageController;
use PDO;
use PDOException;
+use Throwable;
/** @global Tree $WT_TREE */
global $WT_TREE;
@@ -567,7 +568,7 @@ if ($PGV_SCHEMA_VERSION >= 12) {
)->execute([$setting->user_id, $tree->getTreeId(), 'gedcomid', $value]);
}
}
- } catch (\ErrorException $ex) {
+ } catch (Throwable $ex) {
DebugBar::addThrowable($ex);
// Invalid serialized data?
@@ -583,7 +584,7 @@ if ($PGV_SCHEMA_VERSION >= 12) {
)->execute([$setting->user_id, $tree->getTreeId(), 'rootid', $value]);
}
}
- } catch (\ErrorException $ex) {
+ } catch (Throwable $ex) {
DebugBar::addThrowable($ex);
// Invalid serialized data?
@@ -599,7 +600,7 @@ if ($PGV_SCHEMA_VERSION >= 12) {
)->execute([$setting->user_id, $tree->getTreeId(), 'canedit', $value]);
}
}
- } catch (\ErrorException $ex) {
+ } catch (Throwable $ex) {
DebugBar::addThrowable($ex);
// Invalid serialized data?
diff --git a/admin_site_upgrade.php b/admin_site_upgrade.php
index ac1c97f8e6..2ba41d5599 100644
--- a/admin_site_upgrade.php
+++ b/admin_site_upgrade.php
@@ -15,7 +15,6 @@
*/
namespace Fisharebest\Webtrees;
-use Exception;
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Functions\Functions;
use Fisharebest\Webtrees\Functions\FunctionsDate;
@@ -23,6 +22,7 @@ use GuzzleHttp\Client;
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
use League\Flysystem\ZipArchive\ZipArchiveAdapter;
+use Throwable;
require 'includes/session.php';
@@ -229,7 +229,7 @@ foreach (Tree::getAll() as $tree) {
fclose($stream);
rename($filename . '.tmp', $filename);
echo '<br>', I18N::translate('The family tree has been exported to %s.', Html::filename($filename)), $icon_success;
- } catch (\ErrorException $ex) {
+ } catch (Throwable $ex) {
DebugBar::addThrowable($ex);
echo '<br>', I18N::translate('The file %s could not be created.', Html::filename($filename)), $icon_failure;
@@ -243,7 +243,7 @@ echo '</li>';
try {
copy('app/GedcomCode/GedcomCode/Rela.php', WT_DATA_DIR . 'GedcomCodeRela' . date('-Y-m-d') . '.php');
copy('app/GedcomTag.php', WT_DATA_DIR . 'GedcomTag' . date('-Y-m-d') . '.php');
-} catch (\ErrorException $ex) {
+} catch (Throwable $ex) {
DebugBar::addThrowable($ex);
// No problem if we cannot do this.
@@ -313,7 +313,7 @@ try {
echo '<br>', /* I18N: …from the .ZIP file, %2$s is a (fractional) number of seconds */ I18N::plural('%1$s file was extracted in %2$s seconds.', '%1$s files were extracted in %2$s seconds.', $count, $count, I18N::number($end_time - $start_time, 2)), $icon_success;
echo '</li>';
-} catch (Exception $ex) {
+} catch (Throwable $ex) {
DebugBar::addThrowable($ex);
echo '<br>', I18N::translate('An error occurred when unzipping the file.'), $icon_failure;
@@ -332,7 +332,7 @@ echo '<li>', I18N::translate('Place the website offline, by creating the file %s
try {
$data_filesystem->put($lock_file, $lock_file_text);
echo '<br>', I18N::translate('The file %s has been created.', Html::filename($lock_file)), $icon_success;
-} catch (\ErrorException $ex) {
+} catch (Throwable $ex) {
DebugBar::addThrowable($ex);
echo '<br>', I18N::translate('The file %s could not be created.', Html::filename($lock_file)), $icon_failure;
@@ -361,7 +361,7 @@ try {
$end_time = microtime(true);
echo '<br>', /* I18N: …from the .ZIP file, %2$s is a (fractional) number of seconds */ I18N::plural('%1$s file was extracted in %2$s seconds.', '%1$s files were extracted in %2$s seconds.', $count, $count, I18N::number($end_time - $start_time, 2)), $icon_success;
-} catch (Exception $ex) {
+} catch (Throwable $ex) {
DebugBar::addThrowable($ex);
echo '<br>', I18N::translate('The file %s could not be updated.', Html::filename($file['path'])), $icon_failure;
diff --git a/admin_trees_export.php b/admin_trees_export.php
index 55b0a01d5f..dda082ce74 100644
--- a/admin_trees_export.php
+++ b/admin_trees_export.php
@@ -18,6 +18,8 @@ namespace Fisharebest\Webtrees;
/** @global Tree $WT_TREE */
global $WT_TREE;
+use Throwable;
+
require 'includes/session.php';
if (Auth::isManager($WT_TREE) && Filter::checkCsrf()) {
@@ -34,7 +36,7 @@ if (Auth::isManager($WT_TREE) && Filter::checkCsrf()) {
fclose($stream);
rename($filename . '.tmp', $filename);
FlashMessages::addMessage(/* I18N: %s is a filename */ I18N::translate('The family tree has been exported to %s.', Html::filename($filename)), 'success');
- } catch (\ErrorException $ex) {
+ } catch (Throwable $ex) {
DebugBar::addThrowable($ex);
FlashMessages::addMessage(
diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php
index 1b24685bb8..e7ea24147d 100644
--- a/app/Http/Controllers/AdminController.php
+++ b/app/Http/Controllers/AdminController.php
@@ -51,6 +51,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
+use Throwable;
/**
* Controller for the administration pages
@@ -1864,7 +1865,7 @@ class AdminController extends BaseController {
if (getimagesize($thumbanil) === false) {
return 100;
}
- } catch (ErrorException $ex) {
+ } catch (Throwable $ex) {
// If the first file is not an image then similarity is unimportant.
// Response with an exact match, so the GUI will recommend deleting it.
return 100;
diff --git a/app/Http/Controllers/EditMediaController.php b/app/Http/Controllers/EditMediaController.php
index 36014b915f..c76076b298 100644
--- a/app/Http/Controllers/EditMediaController.php
+++ b/app/Http/Controllers/EditMediaController.php
@@ -17,7 +17,6 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\Controllers;
-use ErrorException;
use FilesystemIterator;
use Fisharebest\Webtrees\Database;
use Fisharebest\Webtrees\DebugBar;
@@ -37,6 +36,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
+use Throwable;
/**
* Controller for edit forms and responses.
@@ -232,7 +232,7 @@ class EditMediaController extends BaseController {
File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folder);
rename(WT_DATA_DIR . $MEDIA_DIRECTORY . $media_file->filename(), WT_DATA_DIR . $MEDIA_DIRECTORY . $file);
FlashMessages::addMessage(I18N::translate('The media file %1$s has been renamed to %2$s.', Html::filename($media_file->filename()), Html::filename($file)), 'info');
- } catch (ErrorException $ex) {
+ } catch (Throwable $ex) {
FlashMessages::addMessage($ex, 'info');
FlashMessages::addMessage(I18N::translate('The media file %1$s could not be renamed to %2$s.', Html::filename($media_file->filename()), Html::filename($file)), 'info');
$file = $media_file->filename();
diff --git a/app/Module/BatchUpdate/BatchUpdateSearchReplacePlugin.php b/app/Module/BatchUpdate/BatchUpdateSearchReplacePlugin.php
index 10a450c9e5..7c4223b596 100644
--- a/app/Module/BatchUpdate/BatchUpdateSearchReplacePlugin.php
+++ b/app/Module/BatchUpdate/BatchUpdateSearchReplacePlugin.php
@@ -19,6 +19,7 @@ use Fisharebest\Webtrees\Bootstrap4;
use Fisharebest\Webtrees\DebugBar;
use Fisharebest\Webtrees\Filter;
use Fisharebest\Webtrees\I18N;
+use Throwable;
/**
* Class BatchUpdateSearchReplacePlugin Batch Update plugin: search/replace
@@ -123,7 +124,7 @@ class BatchUpdateSearchReplacePlugin extends BatchUpdateBasePlugin {
// An invalid regex on a null string returns false and throws a warning.
try {
preg_match('/' . $this->search . '/', null);
- } catch (\ErrorException $ex) {
+ } catch (Throwable $ex) {
DebugBar::addThrowable($ex);
$this->error = '<div class="alert alert-danger">' . /* I18N: http://en.wikipedia.org/wiki/Regular_expression */ I18N::translate('The regular expression appears to contain an error. It can’t be used.') . '</div>';