Bug #67221
closedDataHandler class generates a name collision
0%
Description
Under some circumstances class loading fails with the following error:
PHP Fatal error: Cannot use TYPO3\CMS\Backend\Utility\BackendUtility as BackendUtility because the name is already in use in /var/www/t3_plansee/htdocs/typo3conf/ext/news/Classes/Hooks/DataHandler.php on line 18
This is because of line 18 in the DataHandler.php: use TYPO3\CMS\Backend\Utility\BackendUtility
After removing line 18 and replacing the BackendUtility class with the full qualified name it works.
One way to produce this error is to call l10nmgr import cli with php-cgi:"php-cgi" -q -e -d register_argc_argv=1 "cli_dispatch.phpsh" l10nmgr_import --task importFile --preview 1 --file trans.xml --server "http://URL/"
The error occures in the TYPO3\CMS\Core\Core\ClassLoader->loadClass() method in line 197 (typo3 6.2.12:
|| (bool)require_once $classLoadingInformation[0];): if (!empty($classLoadingInformation)) { // The call to class_exists/interface_exists fixes a rare case when early instances need to be aliased // but PHP fails to recognize the real path of the class. See #55904 $loadingSuccessful = class_exists($classLoadingInformation[1], FALSE) || interface_exists($classLoadingInformation[1], FALSE) || (bool)require_once $classLoadingInformation[0]; }
I think it has something to do with the extensions BackendUtility class.
Files
Updated by Markus Klein over 9 years ago
- Status changed from New to Needs Feedback
I don't know what l10nmgr_import does, but this seems very strange. Why would a use statement in a separate file of "news" interfere with the one defined in Core?
Updated by Stefan Gruber over 9 years ago
Here is a description of the l10nmgr import cli:
http://docs.typo3.org/typo3cms/extensions/l10nmgr/ExtLocalizationManager/UsersManual/CommandLineInterface%28cli%29/Index.html#cli-for-import
It is used to import translations from e.g. XML files into Typo3.
As far as I understand this error means, that there is a class with the same alias already in use. In this case the namespace GeorgRinger\News\Hooks contains a class BackendUtility. If you now register an alias in the same namespace for a class with the same name from another namespace you will recieve this error.
I think this is a good explanation: http://stackoverflow.com/questions/11988892/php-unusual-fatal-error-with-name-is-already-in-use
Updated by Markus Klein over 9 years ago
We suspect that there is another extension which does dirty stuff, namely using a "use" statement in ext_localconf/ext_tables.
Can you please scan your extensions' ext_localconf/ext_tables for "use" statements?
Updated by Stefan Gruber over 9 years ago
- File Example.zip Example.zip added
I have checked all the non system extensions, but there is no use statement in one of these files.
I have written a little example which demonstartes the issue by running test.php. In the folder working is a working example.
Updated by Stefan Gruber over 9 years ago
Just saw that the issue was created in the Typo3 core project. It should have been in the news extension. Could you move it please.
I think you can close this issue as it is the same as this one: https://forge.typo3.org/issues/67223
Updated by Georg Ringer over 9 years ago
- Status changed from Needs Feedback to Resolved
thx for your patch!