#57332Call to a member function isPackageActive() on a non-object in .../typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php on line 101
Description
Hi,
I tried to migrate a TYPO3 6.1.latest project to 6.2.0 (exchanged the 6.1 core to 6.2, clearing all previously files in typo3_src).
After I try to access the frontend/backend, I get redirected to “typo3/sysext/install/Start/Install.php” and am presented with the following
PHP error:
Fatal error: Call to a member function isPackageActive() on a non-object in <docroot>/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php on line 101</docroot>
By digging into the core I found a class inheritance bug, as an object, where the object with the isPackageActive() method is included via a dependency injection into another class, but the initation of the injected object is wrong, meaning the class variable isnt initiated i.e. in the constructor or another
init-method.
It only occurs if you try to migrate a given project from 6.1.latest to 6.2, not if you do a 6.2 from scratch.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 4
-
Georg Ringer changed status
NewClosed <span data-processor="relativetime" data-value="2014-03-26T15:29:50+00:00" > 03/26/14, 15:29 </span> -
Stefan Froemken commented <span data-processor="relativetime" data-value="2025-01-09T10:47:25+00:00" > 01/09/25, 10:47 </span>
We just stumbled over the same issue in TYPO3 8.7.
Following Backtrace:- Customer runs page with PHP 7.4
- In vendor/typo3/phar-stream-wrapper:497 there is a $file{0}, but curly braces are deprecated since PHP 7.4
- That’s why TYPO3 error handler will be called
- A TSmessage for TimeTracker will be called
- For that message TYPO3 will add an info-icon
- That info icon is of Type SVG
- SvgProvider will now try to render the icon
- The icon path starts with EXT:core/
- GeneralUtility:getPathEnvAbsWhatEver calls ExtensionManagerUtilits::isLoaded(‘core’)
- At that point self::$packageManager is NULL
The problem is, that the wrong error message about missing $packageManager was protocolled.
I have added a debugging to isLoaded():
if (self::$packageManager === null) { \TYPO3\CMS\Core\Utility\DebugUtility::debug([ 'message' => 'PackageManager is null!', 'extkey' => $key, 'backtrace' => debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), ]); }Which gives me a hint to invest in ErrorHandler much deeper.
In “renderError” I also add some debugging on $errorFile, $errorLine and $errorMessage which directs me to the problem in StreamWrapper file.
Reducing the PHP version to 7.3 helps.
Stefan
-
Martin Weymayer commented <span data-processor="relativetime" data-value="2025-06-26T10:13:45+00:00" > 06/26/25, 10:13 </span>
I had same error in CLI 9.5 and php 7.4. I could fix it with checking class_exists in /typo3/sysext/core/Classes/Utility/GeneralUtility.php:
public static function getFileAbsFileName($filename) { if ((string)$filename === '') { return ''; } // Extension if (strpos($filename, 'EXT:') === 0) { list($extKey, $local) = explode('/', substr($filename, 4), 2); $filename = ''; if (class_exists(ExtensionManagementUtility::class)) { if (method_exists(ExtensionManagementUtility::class, 'isLoaded')) { if ((string)$extKey !== '' && ExtensionManagementUtility::isLoaded($extKey) && (string)$local !== '') { $filename = ExtensionManagementUtility::extPath($extKey) . $local; } #echo 'ExtensionManagementUtility::isLoaded() exists.<br>'; // 2. Test the function with a core extension, e.g., "core" $isLoaded = ExtensionManagementUtility::isLoaded('core'); if ($isLoaded) { #echo 'Extension "core" is loaded.'; } else { #echo 'Extension "core" is NOT loaded or method is not working as expected.'; } } else { #echo 'Method isLoaded() does NOT exist on ExtensionManagementUtility!'; } } else { $filename = ''; #echo 'Class ExtensionManagementUtility does NOT exist!'; } } elseif (!static::isAbsPath($filename)) { // is relative. Prepended with the public web folder $filename = Environment::getPublicPath() . '/' . $filename; } elseif (!( static::isFirstPartOfStr($filename, Environment::getProjectPath()) || static::isFirstPartOfStr($filename, Environment::getPublicPath()) )) { // absolute, but set to blank if not allowed $filename = ''; } if ((string)$filename !== '' && static::validPathStr($filename)) { // checks backpath. return $filename; } return ''; }
PLz close the issue, we found the bug:
We had a “require_once GeneralUtility::getFileAbsFileName( ‘…/Classes/Cache/Backend/SimpleFileBackend.php’);” call in AdditionalConfiguration.php,
which triggered the error. It seems, that getFileAbsFileName triggers the isLoaded at a too early point, I guess require_once should be removed throught the
code , right ?