ensure that version suffixes are case-insensitive#12376
ensure that version suffixes are case-insensitive#12376Seldaek merged 1 commit intocomposer:mainfrom
Conversation
|
Those suffixes were treated as being correct before #12332. |
| "type": "string", | ||
| "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.", | ||
| "pattern": "^v?\\d+(?:[.-]\\d+){0,3}[._-]?(?:(?:stable|beta|b|RC|rc|alpha|a|patch|pl|p)(?:(?:[.-]?\\d+)*+)?)?(?:[.-]?dev|\\.x-dev)?(?:\\+.*)?$|^dev-.*$" | ||
| "pattern": "^v?\\d+(?:[.-]\\d+){0,3}[._-]?(?:(?:[sS][tT][aA][bB][lL][eE]|[bB][eE][tT][aA]|b|RC|rc|[aA][lL][pP][hH][aA]|a|patch|pl|p)(?:(?:[.-]?\\d+)*+)?)?(?:[.-]?dev|\\.x-dev)?(?:\\+.*)?$|^dev-.*$" |
There was a problem hiding this comment.
I wonder if we should do this simpler but less correct like this:
| "pattern": "^v?\\d+(?:[.-]\\d+){0,3}[._-]?(?:(?:[sS][tT][aA][bB][lL][eE]|[bB][eE][tT][aA]|b|RC|rc|[aA][lL][pP][hH][aA]|a|patch|pl|p)(?:(?:[.-]?\\d+)*+)?)?(?:[.-]?dev|\\.x-dev)?(?:\\+.*)?$|^dev-.*$" | |
| "pattern": "^v?\\d+(?:[.-]\\d+){0,3}[._-]?(?:[a-zA-Z]{1,5}?(?:(?:[.-]?\\d+)*+)?)?(?:[.-]?dev|\\.x-dev)?(?:\\+.*)?$|^dev-.*$" |
Or rather make it fully correct and also apply your change to a/p/pl/patch/b variants. It's ugly as hell but more correct.
There was a problem hiding this comment.
I opted for the "ugly as hell" solution
| "type": "string", | ||
| "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.", | ||
| "pattern": "^v?\\d+(?:[.-]\\d+){0,3}[._-]?(?:(?:stable|beta|b|RC|rc|alpha|a|patch|pl|p)(?:(?:[.-]?\\d+)*+)?)?(?:[.-]?dev|\\.x-dev)?(?:\\+.*)?$|^dev-.*$" | ||
| "pattern": "^v?\\d+(?:[.-]\\d+){0,3}[._-]?(?:(?:[sS][tT][aA][bB][lL][eE]|[bB][eE][tT][aA]|b|[rR][cC]|[aA][lL][pP][hH][aA]|[aA]|[pP][aA][tT][cC][hH]|[pP][lL]|[pP])(?:(?:[.-]?\\d+)*+)?)?(?:[.-]?dev|\\.x-dev)?(?:\\+.*)?$|^dev-.*$" |
There was a problem hiding this comment.
Let's uglify some more 😆
| "pattern": "^v?\\d+(?:[.-]\\d+){0,3}[._-]?(?:(?:[sS][tT][aA][bB][lL][eE]|[bB][eE][tT][aA]|b|[rR][cC]|[aA][lL][pP][hH][aA]|[aA]|[pP][aA][tT][cC][hH]|[pP][lL]|[pP])(?:(?:[.-]?\\d+)*+)?)?(?:[.-]?dev|\\.x-dev)?(?:\\+.*)?$|^dev-.*$" | |
| "pattern": "^[vV]?\\d+(?:[.-]\\d+){0,3}[._-]?(?:(?:[sS][tT][aA][bB][lL][eE]|[bB][eE][tT][aA]|[bB]|[rR][cC]|[aA][lL][pP][hH][aA]|[aA]|[pP][aA][tT][cC][hH]|[pP][lL]|[pP])(?:(?:[.-]?\\d+)*+)?)?(?:[.-]?[dD][eE][vV]|\\.x-dev)?(?:\\+.*)?$|^dev-.*$" |
The last ones with dev-/.x-dev I think I'd leave as is as those are typically done by composer and thus more normalized..
There was a problem hiding this comment.
should we make the whole pattern case insensitive to make it less ugly ?
There was a problem hiding this comment.
answering it myself: this is not supported by json-schema.
|
Thanks! |
|
Thanks for merging! 🙇 |
fixes #12374