diff options
author | Louis Chemineau <louis@chmn.me> | 2024-09-18 09:23:19 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2024-09-19 14:24:22 +0200 |
commit | 767af5485e4b3a5bafae2b060ced3cfe2392a6ba (patch) | |
tree | bc4d7c5252cadb4dc5de8918b9223f8f55c8071d /core/templates | |
parent | 61da34520360d3ddaaa97dcd44f4169213bf1d7d (diff) | |
download | nextcloud-server-767af5485e4b3a5bafae2b060ced3cfe2392a6ba.tar.gz nextcloud-server-767af5485e4b3a5bafae2b060ced3cfe2392a6ba.zip |
fix: Prevent duplicate creation of print_exception functionci-fix-30
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'core/templates')
-rw-r--r-- | core/templates/exception.php | 15 | ||||
-rw-r--r-- | core/templates/print_exception.php | 21 | ||||
-rw-r--r-- | core/templates/print_xml_exception.php | 16 | ||||
-rw-r--r-- | core/templates/xml_exception.php | 10 |
4 files changed, 39 insertions, 23 deletions
diff --git a/core/templates/exception.php b/core/templates/exception.php index 5c907038ba2..44f9908c57c 100644 --- a/core/templates/exception.php +++ b/core/templates/exception.php @@ -9,20 +9,7 @@ style('core', ['styles', 'header', 'exception']); -function print_exception(Throwable $e, \OCP\IL10N $l): void { - print_unescaped('<pre>'); - p($e->getTraceAsString()); - print_unescaped('</pre>'); - - if ($e->getPrevious() !== null) { - print_unescaped('<br />'); - print_unescaped('<h4>'); - p($l->t('Previous')); - print_unescaped('</h4>'); - - print_exception($e->getPrevious(), $l); - } -} +require_once __DIR__ . '/print_exception.php'; ?> <div class="guest-box wide"> diff --git a/core/templates/print_exception.php b/core/templates/print_exception.php new file mode 100644 index 00000000000..2def6d4e9d9 --- /dev/null +++ b/core/templates/print_exception.php @@ -0,0 +1,21 @@ +<?php +/** + * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2012-2015 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only + */ + +function print_exception(Throwable $e, \OCP\IL10N $l): void { + print_unescaped('<pre>'); + p($e->getTraceAsString()); + print_unescaped('</pre>'); + + if ($e->getPrevious() !== null) { + print_unescaped('<br />'); + print_unescaped('<h4>'); + p($l->t('Previous')); + print_unescaped('</h4>'); + + print_exception($e->getPrevious(), $l); + } +} diff --git a/core/templates/print_xml_exception.php b/core/templates/print_xml_exception.php new file mode 100644 index 00000000000..94452d8ae9d --- /dev/null +++ b/core/templates/print_xml_exception.php @@ -0,0 +1,16 @@ +<?php +/** + * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2012-2015 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only + */ + +function print_exception(Throwable $e, \OCP\IL10N $l): void { + p($e->getTraceAsString()); + + if ($e->getPrevious() !== null) { + print_unescaped('<s:previous-exception>'); + print_exception($e->getPrevious(), $l); + print_unescaped('</s:previous-exception>'); + } +} diff --git a/core/templates/xml_exception.php b/core/templates/xml_exception.php index 342238d824b..ba808c88595 100644 --- a/core/templates/xml_exception.php +++ b/core/templates/xml_exception.php @@ -5,15 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -function print_exception(Throwable $e, \OCP\IL10N $l): void { - p($e->getTraceAsString()); - - if ($e->getPrevious() !== null) { - print_unescaped('<s:previous-exception>'); - print_exception($e->getPrevious(), $l); - print_unescaped('</s:previous-exception>'); - } -} +require_once __DIR__ . '/print_xml_exception.php'; print_unescaped('<?xml version="1.0" encoding="utf-8"?>' . "\n"); ?> |