Bug #38927

$_EXTCONF was not filled in ext_tables.php

Added by Stefan Froemken almost 9 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2012-07-13
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.2
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

Hello TYPO3-Team,

for each installed extension you inserted following automatically in TEMP_files*:

$_EXTKEY = 'cms';
$_EXTCONF = $TYPO3_CONF_VARS['EXT']['extConf'][$_EXTKEY];

This works good for ext_localconf.php but not for ext_tables.php.

I added following debugging lines:

t3lib_utility_Debug::debug($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'], 'extConfGlobalWhichIsFilled');
t3lib_utility_Debug::debug($TYPO3_CONF_VARS['EXT']['extConf'], 'extConfLocalWhichIsNotFilled');
t3lib_utility_Debug::debug($_EXTKEY, 'extKey');

1.debug) My modified debug in global scope works
2.debug) Your original version returns nothing
3.debug) This is the extkey. No problems with that.

So you should change your code to something like that:

$_EXTKEY = 'cms';
$_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];

Stefan


Files

T3X_sftest-1_0_0-z-201207181642.t3x (5.03 KB) T3X_sftest-1_0_0-z-201207181642.t3x Sample Extension for testing Stefan Froemken, 2012-07-18 16:57
#1

Updated by Ernesto Baschny over 8 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (4.5.18)

I have never got any problem with the variable in ext_tables.php. Could you post some example extension where something is not working as expected please?

#2

Updated by Stefan Froemken over 8 years ago

Hello Ernesto,

following way to run in this problem:

1.) Install devlog
1a) If it is already installed I prefer to truncate devlog table
2.) Install sftest. This is a nearly truncated version of one of our premium extensions.
2a) If you have installed it before you read this, please delete the new row in localconf.php
3.) Extensionconfiguration: Category "BASIC" click on update.
4.) Call a page in FE
5.) Go to BE-Module of devlog
6.) As you can see $_EXTCONF is empty

Next problem:
1.) uncomment the commented line in ext_tables.php and vise versa. Now you should have my modified version.
2.) delete the EXTCONF-Line in localconf.php. Remove temp_* files
3.) Go back to extension configuration category "BASIC" and click on update.
4.) Refresh the page in FE
5.) Go into BE-Module devlog.
6.) Now you can see that ONLY 4 extConf entries are saved. Where are the other 9 entries of the other categories?!?!

Tested with Introduction Package of TYPO3 4.5.17.

Stefan

#3

Updated by Gerrit Code Review over 8 years ago

  • Status changed from Needs Feedback to Under Review

Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/12891

#4

Updated by Ernesto Baschny over 8 years ago

  • % Done changed from 0 to 50

I guess the problem comes from the fact that you are using ext_tables.php in the Frontend and assuming it is run in global scope. See also

http://typo3.org/documentation/document-library/core-documentation/doc_core_api/current/view/2/1/

Search for "ext_tables.php". Quoting:

ext_tables.php is not always included in global scope on the other hand (in the frontend)Don't put functions and classes - or include other files which does - into this script!

In your particular case, I would recommend to put your configuration stuff in ext_localconf.php (as you are adding Typoscript configuration, it seems) and keep the ext_tables.php really for backend configuration (adding modules, adding tables etc).

On the other hand, considering the comment from the documentation, it is also clear that the $_EXTCONF = $TYPO3_CONF_VARS['EXT']['extConf'][$_EXTKEY] is indeed not correct, so adding the $GLOBALS specifier would be correct.

e.g. I now see that felogin also does the same in ext_tables.php:

$_EXTCONF = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['felogin']);

Ok, after doing some research: This has been fixed in 4.6 and later already, in commit d2b697b268fce77802f51c6408ca3feb826422d8 (included in 4.6.0) "[TASK] Remove global declarations inside methods".

So we just need to backport this particular $GLOBALS to TYPO3 4.5. See http://review.typo3.org/12891 and check if this solves your problem.

#5

Updated by Ernesto Baschny over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 50 to 100
#6

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF