Skip to content

[3.0] Stops the theme copy page logging a warning for each language file - #9720

Merged
live627 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/theme-copy-language-listing
Oct 1, 2026
Merged

live627 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/theme-copy-language-listing

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

Themes::copy() (Admin → Themes → Modify themes → theme → Copy a template) also works out which of the default theme's language files the theme already has, and whether each could be overwritten:

$entry = Utils::$context['available_language_files'][$langDir->getFilename() . '/' . $fileInfo->getFilename()];
// ...
... ['can_copy'] = is_writable($theme['theme_dir'] . '/languages/' . $entry);

$entry is the array describing the file, not its name, so every visit logs Array to string conversion once per language file the theme has (twice on a stock forum, for the default theme itself), and the path checked is …/languages/Array. It now checks the file it is looking at.

Tests

tests/Integration/Http/ThemeCopyListTest.php opens the page as the administrator and asserts nothing was logged. Run locally on MySQL and PostgreSQL; tests/Integration/Http is not part of the CI run yet.

Not changed here

The language files are only half a feature, and have been since 2.1. template_copy_template() never shows available_language_files, so there is no link to copy one. The copy itself cannot work either: it only accepts a lang_file whose name is a single character each side of a dot, and reads the source from $_REQUEST['template'] instead. 2.1.7 has the same code. Whether to finish it or remove it seems like a separate decision, so this only stops the warning.

#9717 changes the same method, in a different place.

Issues References (Fixes|Related|Closes)

Related: #9717

🤖 Generated with Claude Code

The theme copy page notes which of the default theme's language files a
theme already has, and whether each can be overwritten. It built the path
to check from the array describing the file rather than from the file,
which logged "Array to string conversion" for every language file the
theme had, and checked a path that does not exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@live627
live627 merged commit dcb403d into SimpleMachines:release-3.0 Oct 1, 2026
11 checks passed
albertlast added a commit to albertlast/SMF2.1 that referenced this pull request Oct 5, 2026
profile_track_ip pinned a fatal that SimpleMachines#9718 has fixed, so it now records the
page. features_basic and profile_theme show the time zone select grouped by
country. themes_copy lists the new TimeZoneSelect template and no longer
logs an array to string conversion, which SimpleMachines#9720 fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants