Bug #18369
closedEM warns No XCLASS inclusion code found if you use $GLOBALS['TYPO3_CONF_VARS']
0%
Description
Some newer PHP5 versions did not find the $TYPO3_CONF_VARS variable. You have had to set explcitely global $TYPO3_CONF_VARS in each PHP file. And inspite of this, sometimes it still did not have it.
To solve this issue I have changed $TYPO3_CONF_VARS to $GLOBALS['TYPO3_CONF_VARS'] in each PHP file.
But now the EM warns with many red lines even if the XCLASS is provided. Example:
if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/tt_products/view/class.tx_ttproducts_single_view.php']) {
include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/tt_products/view/class.tx_ttproducts_single_view.php']);
}
(issue imported from #M7753)
Files
Updated by Dmitry Dulepov about 16 years ago
It looks like you try to include files inside functions, not on the global level. Quite logical that $TYPO£_CONF_VARS is not visible there. See how t3lib_div::requireOnce() does it.
Updated by Steffen Kamper about 16 years ago
don't use $GLOBALS['TYPO3_CONF_VARS'] for XCLASS, EM won't recognize, use $'TYPO3_CONF_VARS instead and all is fine.
Updated by Franz Holzinger about 16 years ago
No Steffen, nothing would be fine with your proposal under some PHP5 or TYPO3 versions. The extensions needed bug fixes for this, because under some TYPO3 and PHP5 versions the $'TYPO3_CONF_VARS has been empty.
Updated by Franz Holzinger about 16 years ago
No Dmitry, it did not help to include even a
global $TYPO3_CONF_VARS;
before all includes in a php file.
You cannot include
t3lib_div::requireOnce()
inside of extensions, if you want it to remain executable also under TYPO3 4.x.
This is the reason why exttensions must move from $TYPO3_CONF_VARS to $GLOBALS['TYPO3_CONF_VARS'] for XCLASS and hooks.
Updated by Franz Holzinger about 16 years ago
This patch is necessary, to not show any more the wrong Code warnings in the EM.
Please open another bug report if you want to have code changes in extensions.
Updated by Christian Kuhn over 14 years ago
committed v3 to:
- trunk, rev. 7644.
- TYPO3_4-3, rev. 7645