Skip to content

Commit

Permalink
User: Fix Settings Should be Initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
kergomard committed Oct 18, 2023
1 parent 16f563c commit c09dc10
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Services/User/classes/class.ilUserXMLWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ class ilUserXMLWriter extends ilXmlWriter

/**
* fields to be exported
*
*/
private array $settings; // Missing array type.
private array $settings = [];

public function __construct()
{
Expand Down Expand Up @@ -109,7 +110,7 @@ public function __handleUser(array $row): void // Missing array type.

$ilDB = $DIC['ilDB'];
$lng = $DIC['lng'];
if (!is_array($this->settings)) {
if ($this->settings === []) {
$this->setSettings(ilObjUserFolder::getExportSettings());
}

Expand Down Expand Up @@ -304,9 +305,9 @@ private function canExport(
string $tagname,
?string $settingsname = null
): bool {
return !is_array($this->settings) ||
in_array(strtolower($tagname), $this->settings) !== false ||
in_array($settingsname, $this->settings) !== false;
return $this->settings === []
|| in_array(strtolower($tagname), $this->settings) !== false
|| in_array($settingsname, $this->settings) !== false;
}

public function setSettings(array $settings): void // Missing array type.
Expand Down

0 comments on commit c09dc10

Please sign in to comment.