From 57609ad8aa21437ed2314ff1b67a6e4f5bff7bb2 Mon Sep 17 00:00:00 2001 From: mjansen Date: Fri, 13 Feb 2026 11:52:29 +0100 Subject: [PATCH 1/2] [Feature] UI: Get rid of `PEAR` usage. This commit suggests removing the `(new PEAR())->raiseError(...)` call and instead throwing an `ilTemplateException`. --- .../ILIAS/UI/tests/Renderer/ilIndependentTemplate.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/components/ILIAS/UI/tests/Renderer/ilIndependentTemplate.php b/components/ILIAS/UI/tests/Renderer/ilIndependentTemplate.php index a0da809762d5..c203e7aae28d 100755 --- a/components/ILIAS/UI/tests/Renderer/ilIndependentTemplate.php +++ b/components/ILIAS/UI/tests/Renderer/ilIndependentTemplate.php @@ -72,12 +72,9 @@ public function getFile(string $filename): string $this->real_filename = $filename; if (!($fh = @fopen($filename, 'rb'))) { - $this->err[] = (new PEAR())->raiseError( - $this->errorMessage(self::IT_TPL_NOT_FOUND) . - ': "' . $filename . '"', - self::IT_TPL_NOT_FOUND + throw new ilTemplateException( + $this->errorMessage(self::IT_TPL_NOT_FOUND) . ': "' . $filename . '"' ); - return ""; } $fsize = filesize($filename); From 9aaa27a56b621174dea4944c1b9a21a5d8253227 Mon Sep 17 00:00:00 2001 From: mjansen Date: Fri, 13 Feb 2026 11:58:30 +0100 Subject: [PATCH 2/2] [Feature] Init: Remove special error handling for "Cannot find this block" This commit removes the special error handling for the "Cannot find this block" error formerly raised by the template engine. This is legacy error handling from a time when the template engine used the `PEAR` error handler. All usages (except one) have already been replaced by a proper `ilTemplateException` years ago. The last usage will be addressed by a dedicated commit. --- .../Init/classes/class.ilErrorHandling.php | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/components/ILIAS/Init/classes/class.ilErrorHandling.php b/components/ILIAS/Init/classes/class.ilErrorHandling.php index 5788bb280145..de02ab1ab7b9 100755 --- a/components/ILIAS/Init/classes/class.ilErrorHandling.php +++ b/components/ILIAS/Init/classes/class.ilErrorHandling.php @@ -150,7 +150,7 @@ private function errorHandler(string $message, int $code, array $backtrace): voi global $log; $session_failure = ilSession::get('failure'); - if ($session_failure && !str_starts_with($message, 'Cannot find this block')) { + if ($session_failure) { $m = 'Fatal Error: Called raise error two times.
' . 'First error: ' . $session_failure . '
' . 'Last Error:' . $message; @@ -159,31 +159,6 @@ private function errorHandler(string $message, int $code, array $backtrace): voi die($m); } - if (str_starts_with($message, 'Cannot find this block')) { - if ($this->isDevmodeActive()) { - echo 'DEVMODE

'; - echo 'Template Block not found.
'; - echo 'You used a template block in your code that is not available.
'; - echo 'Native Messge: ' . $message . '
'; - echo 'Backtrace:
'; - foreach ($backtrace as $b) { - if ($b['function'] === 'setCurrentBlock' && - basename($b['file']) !== 'class.ilTemplate.php') { - echo ''; - } - echo 'File: ' . $b['file'] . ', '; - echo 'Line: ' . $b['line'] . ', '; - echo $b['function'] . '()
'; - if ($b['function'] === 'setCurrentBlock' && - basename($b['file']) !== 'class.ilTemplate.php') { - echo '
'; - } - } - exit; - } - return; - } - if ($log instanceof ilLogger) { $log->write($message); }