TYPO3 / class-alias-loader

Composer Plugin to provide aliases to PHP classes that have been renamed
MIT License
43 stars 12 forks source link

no mapping of namespace class #9

Closed franzholz closed 6 years ago

franzholz commented 6 years ago

I have added an entry for the missing TYPO3 8.x class TYPO3\CMS\Core\Utility\MonitorUtility as it is done here: https://github.com/FriendsOfTYPO3/compatibility7/blob/master/Migrations/Code/ClassAliasMap.php into the extension migration_core file ClassAliasMap.php:

't3lib_utility_Monitor' => \JambageCom\MigrationsCore\Utility\MonitorUtility::class,
'TYPO3\\CMS\\Core\\Utility\\MonitorUtility' => \JambageCom\MigrationsCore\Utility\MonitorUtility::class,   

However when I make a call in this format:

    // Check memory usage
    $callingClassNameMonitor = '\\TYPO3\\CMS\\Core\\Utility\\MonitorUtility';
    call_user_func($callingClassNameMonitor . '::peakMemoryUsage');

Then I always get an exception:

    Uncaught TYPO3 Exception: #1476107295: PHP Warning: call_user_func() expects parameter 1 to be a valid callback, class '\TYPO3\CMS\Core\Utility\MonitorUtility' not found in /home/www/doc/path/demoshop/typo3conf/ext/div2007/class.tx_div2007_alpha5.php line 2227 \| TYPO3\CMS\Core\Error\Exception thrown in file /home/www/doc/path/demoshop/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 107. Requested URL: http://demoshop.jambage.com/index.php?id=11&product=9&no_cache=1&eID=tt_products
helhum commented 6 years ago

could it be that it works, when you remove the leading backslash from the class name?

franzholz commented 6 years ago

indeed it works without the leading backslash.

change '\TYPO3\CMS\Core\Utility\MonitorUtility' ==> 'TYPO3\CMS\Core\Utility\MonitorUtility'