pegasus
Well-known member
- Affected version
- 2.2.13
In XF\Extension::removeClassExtensions, we have:
	
	
	
		
However, this does not check that the key $this->classExtensions[$class] exists before looping it, which throws an invalid key error and a foreach error. Since XF\Extension also provides no getter for $this->classExtensions, there is no easy way for an add-on to know whether this key exists if they need to call ::removeClassExtensions (e.g. inside a setup method to ensure no other add-ons affect the installer's use of a class).
This bug was introduced in 2.2.13.
If it's not too much to ask, ideally we would also have a way to make safer temporary changes like this.
	
	
	
		
				
			
		Code:
	
	foreach ($this->classExtensions[$class] AS $subclass)
{
   unset($this->inverseExtensionMap[$subclass]);
}This bug was introduced in 2.2.13.
If it's not too much to ask, ideally we would also have a way to make safer temporary changes like this.
		Code:
	
	$tmp = $extension->getClassExtensions($forClass);
$extension->removeClassExtensions($forClass);
// do stuff
$extension->setClassExtensionsForClass($forClass, $tmp);
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
 
		 
 
		 
 
		 
 
		 
 
		