aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-09-18 09:23:19 +0200
committerRobin Appelman <robin@icewind.nl>2024-09-19 17:51:51 +0200
commitb731f9533a673e6ba3dd8f16b8e5b4a033019e8c (patch)
tree2c66088766d6c7860d9f57ad4bfc82c0519107cc
parent617c663c3b19a3f9157936baf6777b25f7371e96 (diff)
downloadnextcloud-server-b731f9533a673e6ba3dd8f16b8e5b4a033019e8c.tar.gz
nextcloud-server-b731f9533a673e6ba3dd8f16b8e5b4a033019e8c.zip
fix: Prevent duplicate creation of print_exception functionbackport/48205/stable29
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r--core/templates/exception.php15
-rw-r--r--core/templates/print_exception.php21
-rw-r--r--core/templates/print_xml_exception.php16
-rw-r--r--core/templates/xml_exception.php10
4 files changed, 39 insertions, 23 deletions
diff --git a/core/templates/exception.php b/core/templates/exception.php
index ee35510b26f..be816bb34d3 100644
--- a/core/templates/exception.php
+++ b/core/templates/exception.php
@@ -4,20 +4,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");
?>