Fixed various reentrant-unsafe 2D array element unsets (similar to previous commit)

this pattern was used in various places
This commit is contained in:
Dylan K. Taylor
2023-11-01 16:28:59 +00:00
parent abce512860
commit e6e2c54ec9
3 changed files with 25 additions and 16 deletions

View File

@ -510,9 +510,12 @@ class PluginManager{
unset($this->enabledPlugins[$plugin->getDescription()->getName()]);
foreach(Utils::stringifyKeys($this->pluginDependents) as $dependency => $dependentList){
unset($this->pluginDependents[$dependency][$plugin->getDescription()->getName()]);
if(count($this->pluginDependents[$dependency]) === 0){
unset($this->pluginDependents[$dependency]);
if(isset($this->pluginDependents[$dependency][$plugin->getDescription()->getName()])){
if(count($this->pluginDependents[$dependency]) === 1){
unset($this->pluginDependents[$dependency]);
}else{
unset($this->pluginDependents[$dependency][$plugin->getDescription()->getName()]);
}
}
}