Skip to content

Commit

Permalink
PRG: adjust debug logging for parameter to avoid exhausted memory lim…
Browse files Browse the repository at this point in the history
…it while deleting PRG object(s) in the trash. (37594) (ILIAS-eLearning#6208)
  • Loading branch information
lukastocker authored and nhaagen committed Aug 18, 2023
1 parent 335e461 commit 0244d3b
Showing 1 changed file with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

class ilStudyProgrammeEvents implements StudyProgrammeEvents
{
protected ilAppEventHandler $app_event_handler;
Expand All @@ -34,7 +34,25 @@ public function __construct(

public function raise(string $event, array $parameter): void
{
$this->logger->debug("PRG raised: " . $event . ' (' . print_r($parameter, true) . ')');
$parameter_formatter = static function ($value) use (&$parameter_formatter) {
if (is_object($value)) {
return get_class($value);
}

if (is_array($value)) {
return array_map(
$parameter_formatter,
$value
);
}

return $value;
};

$this->logger->debug("PRG raised: " . $event . ' (' . var_export(array_map(
$parameter_formatter,
$parameter
), true) . ')');

if (in_array($event, [
self::EVENT_USER_ASSIGNED,
Expand Down

0 comments on commit 0244d3b

Please sign in to comment.