Project

General

Profile

Actions

Bug #103009

open

Import of Initialisation Files not working in typical dev setup

Added by Philipp Wrann 10 months ago. Updated 5 months ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
composer
Start date:
2024-02-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When developing your extension, the import of your Initialisation/Files is not working because the path handling wont support the directory structure.

The "typical" setup will be the following:


{
    "config": {
        "vendor-dir": ".Build/vendor",
        "bin-dir": ".Build/bin" 
    },
    "scripts": {
        "post-autoload-dump": [
            "cd .Build/vendor && mkdir -p my_vendor && rm -f my_vendor/my_package && ln -s ../../.. my_vendor/my_package && cd -; fi",
            "mkdir -p .Build/config/system && cd .Build/config/system && ln -sf ../../../Resources/Private/Build/additional.php && cd -; fi" 
        ]
    },
    "extra": {
        "typo3/cms": {
            "web-dir": ".Build/Web",
            "cms-package-dir": "${vendor-dir}/typo3/cms",
            "extension-key": "your_key" 
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require": {
        "php": "^8.2",
        "ext-SimpleXML": "*",
        "ext-json": "*",
        "typo3/minimal": "^12.4" 
    },
    "require-dev": {
        "typo3/testing-framework": "^7",
        "typo3/cms-setup": "^12.4" 
    }
}

It can be seen in many many extensions and is documented here:
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/Testing/ExtensionTesting.html

The "ProjectPath" will not contain your Extension folder and this will lead to non-existing paths:

https://github.com/TYPO3/typo3/blob/main/typo3/sysext/core/Classes/Utility/GeneralUtility.php#L2498

Like mentioned [here](https://forge.typo3.org/issues/102993), there is a setting, that we could use to solve the issue but it is not consistently used in the core:

assuming your setup utilizes a docker container and your extension code is mounted to /app:

$GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'] = '/app/';

The inconsistent path handling existed in earlier versions as well but this problem only affects TYPO3 12+ with composer mode. I guess before the package path has been typo3conf/ext/your_key and now its the absolute path (/app). So this seems to be related to the composer api of typo3.

Actions

Also available in: Atom PDF