Skip to content

Commit e711f04

Browse files
artongebackportbot[bot]
authored andcommitted
fix: Prevent duplicate creation of print_exception function
Signed-off-by: Louis Chemineau <[email protected]> [skip ci]
1 parent 6d9117a commit e711f04

4 files changed

Lines changed: 39 additions & 23 deletions

File tree

core/templates/exception.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,7 @@
44

55
style('core', ['styles', 'header', 'exception']);
66

7-
function print_exception(Throwable $e, \OCP\IL10N $l): void {
8-
print_unescaped('<pre>');
9-
p($e->getTraceAsString());
10-
print_unescaped('</pre>');
11-
12-
if ($e->getPrevious() !== null) {
13-
print_unescaped('<br />');
14-
print_unescaped('<h4>');
15-
p($l->t('Previous'));
16-
print_unescaped('</h4>');
17-
18-
print_exception($e->getPrevious(), $l);
19-
}
20-
}
7+
require_once __DIR__ . '/print_exception.php';
218

229
?>
2310
<div class="guest-box wide">

core/templates/print_exception.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
4+
* SPDX-FileCopyrightText: 2012-2015 ownCloud, Inc.
5+
* SPDX-License-Identifier: AGPL-3.0-only
6+
*/
7+
8+
function print_exception(Throwable $e, \OCP\IL10N $l): void {
9+
print_unescaped('<pre>');
10+
p($e->getTraceAsString());
11+
print_unescaped('</pre>');
12+
13+
if ($e->getPrevious() !== null) {
14+
print_unescaped('<br />');
15+
print_unescaped('<h4>');
16+
p($l->t('Previous'));
17+
print_unescaped('</h4>');
18+
19+
print_exception($e->getPrevious(), $l);
20+
}
21+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
4+
* SPDX-FileCopyrightText: 2012-2015 ownCloud, Inc.
5+
* SPDX-License-Identifier: AGPL-3.0-only
6+
*/
7+
8+
function print_exception(Throwable $e, \OCP\IL10N $l): void {
9+
p($e->getTraceAsString());
10+
11+
if ($e->getPrevious() !== null) {
12+
print_unescaped('<s:previous-exception>');
13+
print_exception($e->getPrevious(), $l);
14+
print_unescaped('</s:previous-exception>');
15+
}
16+
}

core/templates/xml_exception.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,7 @@
55
* SPDX-License-Identifier: AGPL-3.0-only
66
*/
77

8-
function print_exception(Throwable $e, \OCP\IL10N $l): void {
9-
p($e->getTraceAsString());
10-
11-
if ($e->getPrevious() !== null) {
12-
print_unescaped('<s:previous-exception>');
13-
print_exception($e->getPrevious(), $l);
14-
print_unescaped('</s:previous-exception>');
15-
}
16-
}
8+
require_once __DIR__ . '/print_xml_exception.php';
179

1810
print_unescaped('<?xml version="1.0" encoding="utf-8"?>' . "\n");
1911
?>

0 commit comments

Comments
 (0)