#87737check if extensionName is valid
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
-
Georg Ringer commented <span data-processor="relativetime" data-value="2019-02-20T16:25:15+00:00" > 02/20/19, 16:25 </span>
I think we should differentiate between released extensions in TER and local custom extensions. what do you think?
-
Susanne Moog commented and changed tracker
BugFeature category statusNewNeeds Feedback <span data-processor="relativetime" data-value="2019-03-05T07:42:08+00:00" > 03/05/19, 07:42 </span>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?
-
Kay Strobach commented <span data-processor="relativetime" data-value="2020-03-04T15:08:00+00:00" > 03/04/20, 15:08 </span>
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.
-
Christian Kuhn changed status
Needs FeedbackNew <span data-processor="relativetime" data-value="2022-02-19T13:38:20+00:00" > 02/19/22, 13:38 </span> -
Oliver Bartsch commented and changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2025-01-27T15:35:13+00:00" > 01/27/25, 15:35 </span>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 -
Kay Strobach commented <span data-processor="relativetime" data-value="2025-01-27T16:26:13+00:00" > 01/27/25, 16:26 </span>
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.
-
Kay Strobach commented <span data-processor="relativetime" data-value="2025-01-27T16:28:33+00:00" > 01/27/25, 16:28 </span>
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 …)
-
Georg Ringer commented and changed status
Needs FeedbackClosed <span data-processor="relativetime" data-value="2026-10-07T19:21:10+00:00" > 10/07/26, 19:21 </span>closing this issue as it mixes publishing extensions and local extensions. feel free to discuss it in private to solve all open questions
I would expext that these rules are checked in that function.