PHP Namespaces in functions.php can lead to fatal error
I’m not sure whether this should actually be characterised as a bug in create-block-theme, but cloning a theme that uses a PHP Namespace in functions.php can lead to fatal error.
If you want to clone eg. Ollie theme, which uses
namespace Ollie;
in the functions.php file.
And you chose to give the new, cloned theme a name with a space like "My Theme", then the namespace in functions.php in the cloned theme will be set to
namespace My Theme;
This will immediately cause a fatal php error and make the site inaccessible and you would need to switch theme by making a change in the database.
Thanks a lot for all the hard work with create-block-theme - it really brings a huge amount of value to the community.
This will immediately cause a fatal php error and make the site inaccessible and you would need to switch theme by making a change in the database.
Obviously removing spaces from the one line of code in functions.php will also fix the problem.
Thanks for the report. I have created https://github.com/WordPress/create-block-theme/issues/777 to discuss this more extensively, so let's close this issue.