TCA check ignores PHP constants
The TYPO3 9 module "TCA check" fails to check the TCA files in Configuration/TCA or ext_tables.php if PHP constants are used. The PHP constants have been defined in the file ext_localconf.php of the extension.
(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception
PHP Warning: Use of undefined constant DIV2007_EXT - assumed 'DIV2007_EXT' (this will throw an Error in a future version of PHP) in /homepages/mypath/typo3conf/ext/div2007/ext_tables.php line 7
Updated by Susanne Moog over 1 year ago
- Status changed from New to Needs Feedback
Hi and thanks for the report,
just to make sure I get that right:
- you are defining constants in the ext_localconf
- you are using these constants everywhere else?
Does it mean that your code has interdependencies (the ext_tables / TCA files are not able to be loaded independently?)?
If so, I'd suggest to add a check on the constants existence to the ext_tables part if possible.
Updated by Franz Holzinger over 1 year ago
Yes, the constants are defined in the file ext_localconf.php and they are needed in many other files.
Yes, it is possible to add a check about the constants in the TCA files (ext_tables.php has almost no content any more). and redefine the constants there.
However this is a bad practice. I have to define the same constants 13 times, if an extension which has 12 TCA files. So I have duplicate code.
Only the check for TCA fails to get the constants from the file ext_localconf.php.
Updated by Gerrit Code Review over 1 year ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63801
Updated by Gerrit Code Review about 1 year ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63778