Issue Feature Closed

#87737check if extensionName is valid

Kay Strobach 02/19/19, 10:41 updated 10/07/26, 19:21

Description

Right noch ExtensionUtility::checkExtensionNameFormat fails to check the validity of the extension name, as just the empty case is

typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php:243

    /**
     * Check a given extension name for validity.
     *
     * @param string $extensionName The name of the extension
     * @throws \InvalidArgumentException
     */
    protected static function checkExtensionNameFormat($extensionName)
    {
        if (empty($extensionName)) {
            throw new \InvalidArgumentException('The extension name must not be empty', 1239891990);
        }
    }

According to TER docs there are many more rules:

  • Allowed characters are: a-z (lowercase), 0-9 and ‘_’ (underscore)
  • The key must not begin with one of the following prefixes: tx,user_,pages,tt_,sys_,ts_language_,csh_
  • Extension keys must not start with a number and must not start or end with an ‘_’ (underscore)
  • An extension key must have minimum 3, maximum 30 characters (not counting underscores)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 9

  1. Kay Strobach commented 02/19/19, 10:42

    I would expext that these rules are checked in that function.

  2. Georg Ringer commented 02/20/19, 16:25

    I think we should differentiate between released extensions in TER and local custom extensions. what do you think?

  3. Susanne Moog commented and changed tracker Bug Feature category status New Needs Feedback 03/05/19, 07:42

    I’m not aware of the same restrictions as TER has applying to TYPO3 in general. I would not restrict local extension names because of TER rules (This would also be breaking).

    Maybe a check could be introduced and displayed somewhere?

  4. Kay Strobach commented 03/04/20, 15:08

    More Information:

    given you have an extension named:

    vendor_whatever_<number>

    This gets internally converted into

    vendorWhatever<number>

    After that it’s reconverted back into the classic name which is then:

    vendor_whatever<number>

    The problem is that the last “_” is now gone, so the extension can not be loaded.

    This can be fixed in various ways, IMHO the best solution is to display a clear warning about the restrictions about extension naming.

  5. Christian Kuhn changed status Needs Feedback New 02/19/22, 13:38

  6. Oliver Bartsch commented and changed status New Needs Feedback 01/27/25, 15:35

    Hi Kay,

    I had a look into this. As already discussed in the issue, I think we should not restrict local extensions. Also logging a warning that a extension key might not comply with TER rules might be inappropriate for cases where extensions are clearly only local – So a warning which can intentionally never be fixed. If at all, we should log this as notice.

    Besides that, what I would really like to have a look a, is the mentioned “After that it’s reconverted back into the classic name which is then:” place. Could you please point me to this?

    Thanks,
    Oli

  7. Kay Strobach commented 01/27/25, 16:26

    Hi Oliver,

    sure i think the easiest way is to create an extension like:

    vendor_whatever_<number></number>

    Add some extbase classes and use the class loading. I‘m not sure anymore if i used composer mode or not while finding the problem. But I‘m sure that after removing the underscore before the number everything worked fine. With the underscore we had weird behavior.

  8. Kay Strobach commented 01/27/25, 16:28

    I may provide more details in private. As i might relate this to a specific project and probably commit and a following renaming of extensions.

    Regarding the schema for names:

    • BC – agree
    • no hint – possible dealbreaker for new devs

    I would prefer a hint or warning/ even if it’s just in the EM – like (local extension only, name not ok for upload, details can be found here …)

  9. Georg Ringer commented and changed status Needs Feedback Closed 10/07/26, 19:21

    closing this issue as it mixes publishing extensions and local extensions. feel free to discuss it in private to solve all open questions