Project

General

Profile

Actions

Bug #25168

closed

$GLOBALS['TCA'][tablename] breaks backend

Added by Christian Tauscher over 13 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2011-02-24
Due date:
% Done:

0%

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

Description

If via extTables.php a TCA value of some Extention is changed, the whole TCA of this EXT is broken.

Example:
$GLOBALS['TCA']['tt_news']['columns']['image']['config']['allowed'] = 'gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai';

and all Records of tt_news will be "No title" in list Module. The record itself cannot be edited anymore.
Tested with tt_news and some other EXT. All same bad behaviour.

now it becomes even more strange:
$GLOBALS['TCA']['tt_content']['columns']['image']['config']['allowed'] = 'gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai';

does not break the TCA.
Only EXT are affected.

This happens with T3 V4.5.0 and V4.5.1,

T3 V4.4.4 works fine as expected. No Problem there.
(issue imported from #M17754)


Files

extTablesUsage.jpg (143 KB) extTablesUsage.jpg Administrator Admin, 2011-02-26 20:39
17754.patch (1.45 KB) 17754.patch Administrator Admin, 2011-02-27 15:12
17754_v2.patch (1.89 KB) 17754_v2.patch Administrator Admin, 2011-02-27 15:14
17754_v3.patch (1.88 KB) 17754_v3.patch Administrator Admin, 2011-02-28 00:14
Actions #1

Updated by Markus Klein over 13 years ago

After having a look at the current source code, I can assure you, that there is no difference in handling of core tables and ext tables.

Please upload your extTables.php so I can test with this one.

Actions #2

Updated by Christian Tauscher over 13 years ago

Thank you for your response.

I rechecked this with a quite simple setup, so no conflicts ocour.

What I did:

  • Typo3 4.5.1 installed dummy (tgz)
  • Import default database (1-2-3 installer)
  • NO further setup.
  • log into backend.
  • install tt_news (latest from TER).
  • create a test-page and create one record with propper title set.

    -> BE listview of the Record is OK.

  • Goto Tools>Configuration and Edit the TCA of tt_news:
    e..g
    $GLOBALS['TCA']['tt_news']['columns']['image']['config']['allowed'] = 'gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai';

(this does not change anything to the configuration exept this line is written into extTables.php, cause this is the default value)

  • Recheck the Listview -> Broken, Title is "No Title" and you cannot edit the Record (blank page).

next try: maybe ist a tt_-Problem (I remember tt_ is like user some exeption in TYPO3 due to historical reasons).
Install Some EXT with different name e.g. ve_guestbook

  • Create a Record of this EXT
  • Add e.g.
    $GLOBALS['TCA']['tx_veguestbook_entries']['columns']['firstname']['config']['max'] = 25;

-> and you see: No Title.

If you remove the $TCA lines, is works like expected. titles are shown again.

And finally try this with some EXT without even a underscroe in its key: irfaq
Guess -> braken list view, no edit...

But still:
tt_content is not affected if you set
$GLOBALS['TCA']['tt_content']['columns']['date']['config']['default'] = 0;

And last not least, switch to source back to V4.4.4
OK, now the view is broken as well...... maybe not well tested before Sorry for this.

But this is a Bug, isn't it?

Since I have used a relly minimalistic setup, I hope you can repeat this steps easyly.

again checked with 4.5.0,4.5.1,4.5.2, 4.3.9, 4.2.16 (halleluja to the symlinks!)

Actions #3

Updated by Markus Klein over 13 years ago

So you're updating this directly with Tools>Configuration?
Did you check what the content of extTables.php is, after you changed a value there? Or can you post it here?

Thx.

Actions #4

Updated by Christian Tauscher over 13 years ago

So you're updating this directly with Tools>Configuration?

Yes

Did you check what the content of extTables.php is, after you changed a value there? Or can you post it here?

The example lines $GLOBALS['TCA']... are directly taken from extTables.php.
in extTables.php you only find this lines and the default examples (commented out, you know this).

Actions #5

Updated by Markus Klein over 13 years ago

Does your extTables.php contain the lines:
?> ??

Remove them!

Actions #6

Updated by Markus Klein over 13 years ago

This should actually be fixed automatically by some some lowlevel config script.. No idea why it's not.

Actions #7

Updated by Christian Tauscher over 13 years ago

Does your extTables.php contain the lines:

Yes.

Removing stops brekink the BE, but the definitions in this file are not set.

I tried this with some die(); command.

With the die() is executed, without not.
And the definitions are not taking effect (not even wrongly) if is missing.

This should actually be fixed automatically by some some lowlevel config script.. No idea why it's not.

So you can reproduce this behavoir?

Actions #8

Updated by Markus Klein over 13 years ago

Yes I tried exactly with your News lines above.

You can search for TYPO3_extTableDef_script in the core. (See extTablesUsage.jpg)
This is a definition from config_default.php and contains the reference to extTables.php.

Whenever this file is used it is only included like:
include (PATH_typo3conf.TYPO3_extTableDef_script);

And in typo3/sysext/lowlevel/config/index.php there's this code:
$extTables = t3lib_div::getURL(PATH_typo3conf . TYPO3_extTableDef_script);
$extTables = '/is', '', $extTables) . $changedLine . LF . '?>';
$success = t3lib_div::writeFile(PATH_typo3conf . TYPO3_extTableDef_script, $extTables);

Actions #9

Updated by Markus Klein over 13 years ago

I'm off for today. I'll checkout 4.4.4 tomorrow and compare things, maybe we find a difference.

Actions #10

Updated by Christian Tauscher over 13 years ago

Hmmm....

Since I know this script/features did work, I will wait until someone of the core-Team-Gods will take a look on this strange thing.

Thank you Markus for your help so far.

Actions #11

Updated by Markus Klein over 13 years ago

Got it!

TCA is not fully loaded at time of inclusion.

Doing this works out of the box:
t3lib_div::loadTCA('tt_news');
$GLOBALS['TCA']['tt_news']['columns']['image']['config']['allowed'] = 'gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf';

Actions #12

Updated by Oliver Hader over 13 years ago

Thanks Markus for analysing the problem. Thus, the behaviour was just obvious that modifying values that are not loaded yet does not work.
So we could add the loadTCA() call to the Tools>Configuration module if anything else than 'ctrl' gets modified here.

Actions #13

Updated by Markus Klein over 13 years ago

So this means, that for tt_content it's only working without loadTCA because it is loaded by some extension extTables.php?

Actions #14

Updated by Markus Klein over 13 years ago

And here is the patch.
Please test and I'll post it to core list.

Actions #15

Updated by Markus Klein over 13 years ago

And v2 beautifys the flash message.

Actions #16

Updated by Christian Tauscher over 13 years ago

Thank you a lot, Markus - you made my day!

Thus, the behaviour was just obvious

Now as you say this, I remember this, too. I read this, somewhere some ages ago (insideTypo3-manual?).

But i am not one of this hard-core-TCA-Junkies, so i forgott about.

So we could add the loadTCA()

I dont think it should be added there, cause: The suggested call in Tools>Configuration is "wrong".
for inclusion in extTables.php you have to change it from $TCA... (usable for tca.php, where loadTCA is called) to
$GLOBALS['TCA']...

it should be enough to include in the extTables.php file some commented hint to this "Problem"/behaviour with none tt_content-tables.

From my point of view this case may be closed as solved.

Actions #17

Updated by Markus Klein over 13 years ago

I dont think it should be added there, cause: The suggested call in Tools>Configuration is "wrong".
for inclusion in extTables.php you have to change it from $TCA... (usable for tca.php, where loadTCA is called) to
$GLOBALS['TCA']...

Sorry I don't get your point here. Can you explain in more detail please?

Actions #18

Updated by Christian Tauscher over 13 years ago

quote from default extTables.php:

// Raise upload limit for images in 'image' content-elements to 10*1024 bytes = 1MB
$GLOBALS['TCA']['tt_content']['columns']['image']['config']['max_size'] = 10*1024;

But if you do this with Tools>Configuration, the code to add says:

$TCA['tt_content']['columns']['image']['config']['max_size'] = 20480;

so this is the reason why I belive this must be changed to $GLOBALS['TCA'].

Short: is there a reson for the examples given in extTables.php differ from suggestion in Tools>Configuration?

confused....???

is $GLOBALS['TCA'] == $TCA ?
Does your patch still require the loadTCA() statement?

Actions #19

Updated by Markus Klein over 13 years ago

$TCA is the same as $GLOBALS['TCA'] if you import it from global scope by writing something like "global ...".

Yes Tools>Configuration generates this:
$TCA['tt_conten....
But
When you click on the button this is replaced by
$GLOBALS['TCA']['tt_cont.....
and then written to extTables.php

Actions #20

Updated by Christian Tauscher over 13 years ago

I see... tryed it and: yes, it's the same.
Thank your for your help, again

:-)

Actions #21

Updated by Markus Klein over 13 years ago

Did you test my patch?

Please vote for it on core list!

Actions #22

Updated by Dmitry Dulepov over 13 years ago

Just load TCA for the table before trying to modify it... t3lib_div::loadTCA() is all you need and must do actually.

No change necessary in TYPO3.

Actions #23

Updated by Markus Klein over 13 years ago

Hi Dmitry,

but that's exactly what my patch does.
If the user uses Tools->Configuration for making changes to TCA he will not modify extTables.php manually, so TYPO3 should take care of added the required loadTCA.

Actions #24

Updated by Markus Klein over 13 years ago

Please logon to Gerrit and review the patch there.

http://review.typo3.org/

User/Pwd same as for bugtracker here.
Thx.

Actions #25

Updated by Steffen Gebert over 13 years ago

Merged to master 246e57d484123fcf2617d758118ade456bb124a5

Actions #27

Updated by Steffen Gebert over 13 years ago

Merged to 4-5 in 42da5edaab8d29e99bc69475e5aa4eb74b205691

Actions #28

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF