Concrete 5.7 page_theme.php PSR issue

Before 5.7, I used to often name theme directories along the lines of "my_site_20XX", where 20XX was the year the theme was created. This way, when we rolled out new themes for a site later, I could easily preserve the old theme by incrementing the year accordingly and activating the new theme.

This doesn't work with Concrete 5.7.

The theme works, but C5 cannot find/use the page_theme.php file. When I name a theme directory using that convention, it appears that C5 is looking for application/themes/my_site20XX/page_theme.php (without the underscore before 20XX).

Presumably, this has something to do with that segment of the directory name starting with a number, but I didn't think that this was against the naming convention Concrete 5.7 uses. Am I doing something wrong, or is there a way to do this?

View Replies:
jgarcia replied on at Permalink Reply
Okay, I'm getting a little closer. On line 64 of concrete/src/FoundationModifiedPsr4ClassLoader.php:

$chunks = preg_split('/(?=[A-Z])/', $segment);

This splits Application\Theme\MySite2015\PageTheme into chunks based on uppercase letters. Hence it's not seeing a split at "2015" so you end up with it looking for /application/themes/my_site2015/page_theme.php, which doesn't exist.

So...feature or bug? Of course, I vote bug. But I think it's a legitimate concern. I'm not super-familiar with all the PHP PSR stuff, but can you not start a segment with a number?
MrKDilkington replied on at Permalink Reply
Hi jgarcia,

I would not have expected there to be a problem with my_site_20XX either.

As a quick fix, could you use my_site_v20XX?
jgarcia replied on at Permalink Reply
Good point. That would work.
ramonleenders replied on at Permalink Reply
I seem to have no problems with folder name "my_site2015" and namespace "Application\Theme\MySite2015". On version, but the preg_split is the same..