*/
public $packageID = PACKAGE_ID;
+ /**
+ * contains categories currently being loaded as array keys
+ * @var bool[]
+ */
+ protected $categoriesBeingLoaded = [];
+
/**
* Returns the name of this language.
*
// search language file
$filename = WCF_DIR.'language/'.$this->languageID.'_'.$category.'.php';
if (!@file_exists($filename)) {
+ if (isset($this->categoriesBeingLoaded[$category])) {
+ throw new \LogicException("Circular dependency detected! Cannot load category '{$category}' while it is already being loaded.");
+ }
+
if ($this->editor === null) {
$this->editor = new LanguageEditor($this);
}
return false;
}
+ $this->categoriesBeingLoaded[$category] = true;
+
$this->editor->updateCategory($languageCategory);
+
+ unset($this->categoriesBeingLoaded[$category]);
}
// include language file