#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
-
Kay Strobach commented 02/19/19, 10:42
-
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?
-
Susanne Moog commented and changed tracker
BugFeature category statusNewNeeds Feedback 03/05/19, 07:42I’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 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.
-
Christian Kuhn changed status
Needs FeedbackNew 02/19/22, 13:38 -
Oliver Bartsch commented and changed status
NewNeeds Feedback 01/27/25, 15:35Hi 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 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.
-
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 …)
-
Georg Ringer commented and changed status
Needs FeedbackClosed 10/07/26, 19:21closing 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.