[wp-trac] [WordPress Trac] #61182: Normalize UTF-8 charset slug detection.

WordPress Trac noreply at wordpress.org
Fri May 17 11:38:00 UTC 2024


#61182: Normalize UTF-8 charset slug detection.
----------------------------------------+-----------------------
 Reporter:  dmsnell                     |       Owner:  dmsnell
     Type:  enhancement                 |      Status:  reopened
 Priority:  normal                      |   Milestone:  6.6
Component:  General                     |     Version:  trunk
 Severity:  normal                      |  Resolution:
 Keywords:  has-unit-tests needs-patch  |     Focuses:
----------------------------------------+-----------------------
Changes (by swissspidy):

 * keywords:  has-patch has-unit-tests => has-unit-tests needs-patch


Comment:

 I don't think these are compelling enough reasons to create a new file
 just for this 1 function. If we want to move more similar functions
 together in a new file, then that can be done separately in one go.

 Also, right now, this separate location causes a fatal error when a site
 is in maintenance mode.

 {{{

 <br />
 <b>Fatal error</b>:  Uncaught Error: Call to undefined function
 is_utf8_charset() in /Users/pascalb/Local Sites/media-
 experiments/app/public/wp-includes/functions.php:7481
 Stack trace:
 #0 /Users/pascalb/Local Sites/media-experiments/app/public/wp-
 includes/functions.php(4310): _canonical_charset('utf-8')
 #1 /Users/pascalb/Local Sites/media-experiments/app/public/wp-
 includes/functions.php(3804): _wp_die_process_input('Briefly unavail...',
 'Maintenance', Array)
 #2 /Users/pascalb/Local Sites/media-experiments/app/public/wp-
 includes/functions.php(3787): _default_wp_die_handler('Briefly
 unavail...', 'Maintenance', Array)
 #3 /Users/pascalb/Local Sites/media-experiments/app/public/wp-
 includes/load.php(388): wp_die('Briefly unavail...', 'Maintenance', Array)
 #4 /Users/pascalb/Local Sites/media-experiments/app/public/wp-
 settings.php(76): wp_maintenance()
 #5 /Users/pascalb/Local Sites/media-experiments/app/public/wp-
 config.php(95): require_once('/Users/pascalb/...')
 #6 /Users/pascalb/Local Sites/media-experiments/app/public/wp-
 load.php(50): require_once('/Users/pascalb/...')
 #7 /Users/pascalb/Local Sites/media-experiments/app/public/wp-
 login.php(12): require('/Users/pascalb/...')
 #8 {main}
   thrown in <b>/Users/pascalb/Local Sites/media-experiments/app/public/wp-
 includes/functions.php</b> on line <b>7481</b><br />

 }}}

 `wp_maintenance()` is called early in `wp-settings.php`, before
 `unicode.php` is loaded, and exits. `wp_maintenance()` manually loads
 `functions.php` and then exits. Hence the error.

 That's another reason why this should be moved to `functions.php`

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


More information about the wp-trac mailing list