You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TYPO3 6.2 LTS升级至8.7 LTS后TCA自表选择内存溢出问题求助

TYPO3 8.7 LTS自关联选择控件内存耗尽问题解决方案

Hey Markus, I’ve run into similar headaches when upgrading TYPO3 from 6.2 to 8.7, so I can confirm this is a real behavior shift between those versions. Let’s break down why it’s happening and how to fix it.

Why This Happens

TYPO3 6.2 handled self-referential TCA select controls more leniently, often quietly limiting recursive queries under the hood. But starting with TYPO3 7.x (and carried over to 8.7), the query builder and TCA processing logic got stricter—without explicit limits, a self-referential select will try to load related records recursively in an infinite loop, eating up all available memory until the process crashes.

Fixes to Try

Assuming your TCA override in Configuration/TCA/Override/tt_address.php defines a self-referential select field, here are the most effective fixes tailored to different use cases:

1. Exclude the Current Record (For Non-Tree Selections)

If you just need users to pick other tt_address records (not build a hierarchy), add a foreign_table_where clause to exclude the current record itself. This cuts off immediate self-selection and prevents recursive loops from starting:

$GLOBALS['TCA']['tt_address']['columns']['your_field_name']['config'] = [
    'type' => 'select',
    'foreign_table' => 'tt_address',
    'size' => 5,
    'maxitems' => 10,
    // Add this line to exclude the record being edited
    'foreign_table_where' => 'AND tt_address.uid != ###THIS_UID###',
];

The ###THIS_UID### marker dynamically replaces itself with the UID of the record you’re editing, so it always excludes the current entry.

2. Limit Recursion Depth (For Tree/Hierarchy Structures)

If you’re using the field to build a parent-child hierarchy (like linking a child address to a parent), switch to the selectTree renderType and explicitly set a maximum recursion level. This tells TYPO3 to stop loading records after a certain depth:

$GLOBALS['TCA']['tt_address']['columns']['parent_address']['config'] = [
    'type' => 'select',
    'renderType' => 'selectTree',
    'foreign_table' => 'tt_address',
    'treeConfig' => [
        'parentField' => 'parent_address', // Match your actual parent field name
        'appearance' => [
            'expandAll' => false,
            'showHeader' => true,
        ],
        'maxLevels' => 5, // Adjust to your needs (3-5 levels is usually enough)
    ],
    'size' => 1,
    'maxitems' => 1,
];

Setting maxLevels is critical here—it stops the tree from expanding infinitely.

3. Audit for Hidden Circular References

Double-check if your TCA uses an MM table for many-to-many self-references. If so, make sure the MM table doesn’t have any settings that could create unconstrained circular lookups. Adding a filter to the MM join conditions can prevent unexpected recursion here too.

Verification

After applying your fix, clear TYPO3’s system cache (via the Install Tool or Backend Cache menu) and test the select control again. You should no longer hit memory limits, and the control will load only the intended records.

内容的提问来源于stack exchange,提问作者Markus Gehrig

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 09:17:11