Project

General

Profile

Bug #90635

Updated by Tymoteusz Motylewski about 4 years ago

h2. Problem 

 
 h3. Given 

 
 - an extension e.g. yoast_seo copied to typo3conf/ext/yoast_typo3 (folder different than extension key) 
 - this extension has TYPOScript which references some file using EXT:yoast_seo syntax 


 h3. Result: 

 
 - Backend is broken with "Call to a member function getPackagePath() on null" in ExtensionManagerUtility 

 h3. Expected: 

 
 - the file inclusion is ignored, or its loaded (as TYPO3 can correctly translate yoast_seo to yoast_typo3 with <pre>$this->getPackageKeyFromComposerName($packageKey);</pre> 

 h2. Technical details: 

 
 in this setup 
 - PackageManager->isPackageActive('yoast_seo') return TRUE 
 - PackageManager->getPackageKeyFromComposerName('yoast_seo') returns 'yoast_typo3' 
 - PackageManager->isPackageRegistered('yoast_seo') returns TRUE 
 - PackageManager->isPackageAvailable('yoast_seo')returns TRUE 
 - ExtensionManagementUtility::isLoaded('yoast_seo') returns TRUE 
 - ExtensionManagementUtility::extPath('yoast_seo') throws    "Call to a member function getPackagePath() on null" 
 - because    PackageManager->getPackage('yoast_seo') returns null 

 Seems like the API is inconsistent here. 


 h2. Possible solution: 

 
 change  
 <pre> 
     public function getPackage($packageKey) 
     { 
         if (!$this->isPackageRegistered($packageKey) && !$this->isPackageAvailable($packageKey)) { 
             throw new Exception\UnknownPackageException('Package "' . $packageKey . '" is not available. Please check if the package exists and that the package key is correct (package keys are case sensitive).', 1166546734); 
         } 
         return $this->packages[$packageKey]; 
     } 
 </pre> 
 to: 
 <pre> 
     public function getPackage($packageKey) 
     { 
         if (!$this->isPackageRegistered($packageKey) && !$this->isPackageAvailable($packageKey)) { 
             throw new Exception\UnknownPackageException('Package "' . $packageKey . '" is not available. Please check if the package exists and that the package key is correct (package keys are case sensitive).', 1166546734); 
         } 
         return $this->packages[$this->getPackageKeyFromComposerName($packageKey)]; 
     } 
 </pre> 

Back