diff options
author | Louis Chemineau <louis@chmn.me> | 2024-09-18 09:23:19 +0200 |
---|---|---|
committer | Louis <louis@chmn.me> | 2024-10-01 14:46:17 +0200 |
commit | 2a10014d0f5a1412f16df799668dd6d3b5be0fe3 (patch) | |
tree | e06573f4f7d87cba3377f87359993762d2a932e6 | |
parent | 75d7537b0976301069c83d07b3296d1fad9399d1 (diff) | |
download | nextcloud-server-backport/48297/stable26.tar.gz nextcloud-server-backport/48297/stable26.zip |
fix: Prevent duplicate creation of print_exception functionbackport/48297/stable26
Signed-off-by: Louis Chemineau <louis@chmn.me>
-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 d26e9ff4f94..324724e67ac 100644 --- a/core/templates/exception.php +++ b/core/templates/exception.php @@ -4,20 +4,7 @@ style('core', ['styles', 'header']); -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"); ?> |