Bug #76958

displayCond LOADED does not check the loaded extension

Added by Franz Holzinger almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-07-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

In TYPO3 7.6.6 the TCA does not check the displayCond if an extension has been installed. Then it raises a #1444996537 TYPO3 exception.

The TCA column is:

'gained_voucher' => array (
    'exclude' => 1,
    'displayCond' => 'EXT:voucher:LOADED:true',
    'label' => 'LLL:EXT:' . TT_PRODUCTS_EXT . '/locallang_db.xml:sys_products_orders.gained_voucher',
    'config' => array (
        'type' => 'inline',
        'appearance' => array ('collapseAll' => TRUE, 'newRecordLinkAddTitle' => TRUE, 'useCombination' => TRUE),
        'foreign_table' => 'sys_products_orders_mm_gained_voucher_codes',
        'foreign_field' => 'uid_local',
        'foreign_sortby' => 'sorting',
        'foreign_label' => 'uid_foreign',
        'foreign_selector' => 'uid_foreign',
        'foreign_unique' => 'uid_foreign',
        'maxitems' => 100
    ),
),

The TCA of sys_products_orders_mm_gained_voucher_codes is dependant on the extension voucher, which is not installed in this case.

if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('voucher')) {
    // ******************************************************************
    // order to voucher codes table, sys_products_orders_mm_gained_voucher_codes
    // ******************************************************************
    $result = array (
        'ctrl' => array (
            'title' => 'LLL:EXT:' . TT_PRODUCTS_EXT . '/locallang_db.xml:sys_products_orders_mm_gained_voucher_codes',
            'label' => 'uid_local',
            'tstamp' => 'tstamp',
            'delete' => 'deleted',
            'enablecolumns' => array (
                'disabled' => 'hidden'
            ),


Uncaught TYPO3 Exception
#1444996537: Table sys_products_orders field gained_voucher points in foreign_selector or foreign_unique to field uid_foreign of table sys_products_orders_mm_gained_voucher_codes, but this field is either not defined or is not of type select or group (More information)

UnexpectedValueException thrown in file
/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInlineConfiguration.php in line 242.

15 TYPO3\CMS\Backend\Form\FormDataProvider\TcaInlineConfiguration::addInlineSelectorAndUniqueConfiguration(array, "gained_voucher")

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInlineConfiguration.php:

00049:             $result = $this->initializeLocalizationMode($result, $fieldName);
00050:             $result = $this->initializeAppearance($result, $fieldName);

00051:             $result = $this->addInlineSelectorAndUniqueConfiguration($result, $fieldName);

00052:         }
00053:         return $result;

14 TYPO3\CMS\Backend\Form\FormDataProvider\TcaInlineConfiguration::addData(array)

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/sysext/backend/Classes/Form/FormDataGroup/TcaDatabaseRecord.php:

00049:             }
00050: 

00051:             $result = $provider->addData($result);

00052:         }
00053: 

13 TYPO3\CMS\Backend\Form\FormDataGroup\TcaDatabaseRecord::compile(array)

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/sysext/backend/Classes/Form/FormDataCompiler.php:

00097:         $resultKeysBeforeFormDataGroup = array_keys($result);
00098: 

00099:         $result = $this->formDataGroup->compile($result);

00100: 
00101:         if (!is_array($result)) {

12 TYPO3\CMS\Backend\Form\FormDataCompiler::compile(array)

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/sysext/backend/Classes/Controller/EditDocumentController.php:

01109:                                 }
01110: 

01111:                                 $formData = $formDataCompiler->compile($formDataCompilerInput);

01112: 
01113:                                 // Set this->viewId if possible

11 TYPO3\CMS\Backend\Controller\EditDocumentController::makeEditForm()

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/sysext/backend/Classes/Controller/EditDocumentController.php:

01000:             }
01001:             // Creating the editing form, wrap it with buttons, document selector etc.

01002:             $editForm = $this->makeEditForm();

01003:             if ($editForm) {
01004:                 $this->firstEl = reset($this->elementsData);

10 TYPO3\CMS\Backend\Controller\EditDocumentController::main()

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/sysext/backend/Classes/Controller/EditDocumentController.php:

02018: 
02019:         $this->init();

02020:         $this->main();

02021: 
02022:         $response->getBody()->write($this->moduleTemplate->renderContent());

9 TYPO3\CMS\Backend\Controller\EditDocumentController::mainAction(TYPO3\CMS\Core\Http\ServerRequest, TYPO3\CMS\Core\Http\Response)

8 call_user_func_array(array, array)

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/sysext/backend/Classes/Http/RouteDispatcher.php:

00052:         $targetIdentifier = $route->getOption('target');
00053:         $target = $this->getCallableFromTarget($targetIdentifier);

00054:         return call_user_func_array($target, array($request, $response));

00055:     }
00056: 

7 TYPO3\CMS\Backend\Http\RouteDispatcher::dispatch(TYPO3\CMS\Core\Http\ServerRequest, TYPO3\CMS\Core\Http\Response)

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/sysext/backend/Classes/Http/RequestHandler.php:

00159:         /** @var RouteDispatcher $dispatcher */
00160:         $dispatcher = GeneralUtility::makeInstance(RouteDispatcher::class);

00161:         return $dispatcher->dispatch($request, $response);

00162:     }
00163: }

6 TYPO3\CMS\Backend\Http\RequestHandler::dispatch(TYPO3\CMS\Core\Http\ServerRequest)

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/sysext/backend/Classes/Http/RequestHandler.php:

00092:         // Check if the router has the available route and dispatch.
00093:         if ($routingEnabled) {

00094:             return $this->dispatch($request);

00095:         }
00096: 

5 TYPO3\CMS\Backend\Http\RequestHandler::handleRequest(TYPO3\CMS\Core\Http\ServerRequest)

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/sysext/core/Classes/Core/Bootstrap.php:

00300: 
00301:         // Execute the command which returns a Response object or NULL

00302:         $this->response = $requestHandler->handleRequest($request);

00303:         return $this;
00304:     }

4 TYPO3\CMS\Core\Core\Bootstrap::handleRequest(TYPO3\CMS\Core\Http\ServerRequest)

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/sysext/backend/Classes/Http/Application.php:

00092:         }
00093: 

00094:         $this->bootstrap->handleRequest($this->request);

00095: 
00096:         if ($execute !== null) {

3 TYPO3\CMS\Backend\Http\Application::run()

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/index.php:

00018: call_user_func(function () {
00019:     $classLoader = require __DIR__ . '/../vendor/autoload.php';

00020:     (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();

00021: });

2 {closure}()

1 call_user_func(Closure)

/home/mywebsite/public_html/mywebsite/typo3_src-7.6.6/typo3/index.php:

00019:     $classLoader = require __DIR__ . '/../vendor/autoload.php';
00020:     (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();

00021: });

Related issues

Related to TYPO3 Core - Bug #70052: TCA displayCond not evaluatedClosed2015-09-23

Actions
Related to TYPO3 Core - Bug #78853: BE doesn't execute displayCond of extension flexformRejected2016-12-01

Actions
#1

Updated by Markus Klein almost 5 years ago

  • Description updated (diff)
#3

Updated by Christian Kuhn almost 5 years ago

  • Status changed from New to Closed

franz,

you are correct, there are situations where the isloaded condition does no longer work. if i remember correctly, this can depend on the load order of the two extensions involved for instance. this scenario is very hard to resolve and was - next to the fact that the isloaded idea contradicts with other tca concepts - the reason to deprecate this construct in version 7 and to remove it in version 8. also, i see no good solution to further mitigate this in version 7.

you should get rid of this condition from your codebase, it is not reliable. the easiest solution is to move the field definition to the other extension and let it add from there in tca/overrides if tt_products is loaded.

i'll close the issue since i see no good way to solve that on core side.

#4

Updated by Franz Holzinger almost 5 years ago

This is bad that TYPO3 does not offer any possibility to influence the load order of an extension, except by setting another extension as recommended, which many users do not understand. It is not usable to have many recommended extensions.

Your solution to move the field definition to the other extension does not work. The other extension cannot be made responsible to add a field to the first extension. Such a thing would complicate everything. The second extension does only offer a new feature and a table. It is not the task of the second extension to investigate about other extensions which want to use its features.

Also available in: Atom PDF