[wp-trac] [WordPress Trac] #47546: The language used for the `lang` attribute isn't validated before being used

WordPress Trac noreply at wordpress.org
Mon Jun 16 11:33:45 UTC 2025


#47546: The language used for the `lang` attribute isn't validated before being
used
-------------------------------------------------+-------------------------
 Reporter:  johnbillion                          |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  low                                  |   Milestone:  Future
                                                 |  Release
Component:  I18N                                 |     Version:
 Severity:  minor                                |  Resolution:
 Keywords:  has-patch has-test-info changes-     |     Focuses:
  requested                                      |
-------------------------------------------------+-------------------------
Changes (by SirLouen):

 * keywords:  has-patch needs-test-info => has-patch has-test-info changes-
     requested


Comment:

 == Test Report
 === Description
 - ❌ This report validates whether the indicated patch is working as
 expected.

 Patch tested: https://github.com/WordPress/wordpress-
 develop/pull/8942.diff

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.28
 - Server: nginx/1.27.5
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
 - Browser: Chrome 137.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-One 2.5
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.0

 === Test Instructions
 1. So here there [https://github.com/WordPress/wordpress-develop/pull/8942
 are some clear instructions]
 2. But I have combined them with the ones in the OP
 3. Make sure you have the Spanish language installed. Got to `wp-
 content/languages` and check that you have the es_ES files.
 4. Issue the `wp-cli` command `wp user meta update admin locale es_ES` to
 set a custom locale for admin interface
 5. Check the HTML tag in the WP administration area
 6. ✅ lang=`es` in the HTML tag, as expected, since `es_ES` is installed
 7. Now Make sure you don't have Italian language installed. Go to `wp-
 content/languages` and remove all *it_IT* files.
 8. Issue the `wp-cli` command `wp user meta update admin locale it_IT` to
 set a custom locale for admin interface
 9. Check the HTML tag in the WP administration area
 10. 🐞 lang=`it_IT` despite that there is are no `it_IT` lang files
 installed

 === Expected Results
 - Considering that `en_US` is the default installed language, it should
 default to this if the selected custom lang is not installed.

 === Actual Results
 1.  ❌ Issue not resolved with patch: it forces to `en_US` in all
 scenarios

 === Additional Notes
 - @sukhendu2002 review this. When I have for example es_ES lang files, I
 set `es_ES` in cli and then I go into the admin, it shows `en_US`. This
 doesn't happen without the patch, so it's a regression.

 Also, by the way, try to write everything here in Trac, not in GitHub.
 It's better to keep full context here in Trac, because it doesn't matter
 if anyone else opens a new PR, we will have all the context always here by
 all the collaborators that worked in the report.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47546#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list