Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorHandling/SOAP: Use SOAP exception handler for HTTP POST only #9111

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions Services/Init/classes/class.ilErrorHandling.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,12 @@ protected function initWhoopsHandlers(): void
*/
public function getHandler(): HandlerInterface
{
if (ilContext::getType() === ilContext::CONTEXT_SOAP) {
if (ilContext::getType() === ilContext::CONTEXT_SOAP &&
strcasecmp($_SERVER['REQUEST_METHOD'] ?? '', 'post') === 0) {
return new ilSoapExceptionHandler();
}

// TODO: There might be more specific execution contexts (WebDAV, REST, etc.) that need specific error handling.
// TODO: There might be more specific execution contexts (WebDAV, REST, etc.) that need specific error handling.

if ($this->isDevmodeActive()) {
return $this->devmodeHandler();
Expand Down Expand Up @@ -393,7 +394,7 @@ protected function parseEditorPathTranslation(string $pathTranslationConfig): ar
protected function loggingHandler(): HandlerInterface
{
/**
* @var
* @var
*/
return new CallbackHandler(function ($exception, Inspector $inspector, Run $run) {
/**
Expand All @@ -409,15 +410,15 @@ protected function loggingHandler(): HandlerInterface
$previous = $exception->getPrevious();
while ($previous) {
$message .= "\n\nCaused by\n" . sprintf(
'%s: %s in file %s on line %d',
get_class($previous),
$previous->getMessage(),
$previous->getFile(),
$previous->getLine()
);
'%s: %s in file %s on line %d',
get_class($previous),
$previous->getMessage(),
$previous->getFile(),
$previous->getLine()
);
$previous = $previous->getPrevious();
}

$ilLog->error($exception->getCode() . ' ' . $message);
}

Expand Down