Opened 2 years ago
Closed 23 months ago
#57218 closed defect (bug) (fixed)
undefined function trailingslashit() when .maintenance present - Windows server
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.2 | Priority: | normal |
Severity: | normal | Version: | 6.1 |
Component: | I18N | Keywords: | has-patch fixed-major |
Focuses: | Cc: |
Description
This is the first core bug I've ever reported so apologies if I don't quite follow correct protocol.
When if I am doing manual updates on any of the sites on my server, and place a .maintenance file in the site root, instead of getting the nice ‘under maintenance’ message they throw a 500 error like this…
HP Fatal error: Uncaught Error: Call to undefined function trailingslashit() in D:\HTTP\WP_Sites\Recipes\wp-includes\class-wp-textdomain-registry.php:103 Stack trace: #0 D:\HTTP\WP_Sites\Recipes\wp-includes\l10n.php(784): WP_Textdomain_Registry->set('default', 'en_AU', 'D:\\HTTP\\WP_Site...') #1 D:\HTTP\WP_Sites\Recipes\wp-includes\load.php(1401): load_textdomain('default', 'D:\\HTTP\\WP_Site...', 'en_AU') #2 D:\HTTP\WP_Sites\Recipes\wp-includes\load.php(278): wp_load_translations_early() #3 D:\HTTP\WP_Sites\Recipes\wp-settings.php(74): wp_maintenance() #4 D:\HTTP\WP_Sites\Recipes\wp-config.php(98): require_once('D:\\HTTP\\WP_Site...') #5 D:\HTTP\WP_Sites\Recipes\wp-load.php(50): require_once('D:\\HTTP\\WP_Site...') #6 D:\HTTP\WP_Sites\Recipes\wp-blog-header.php(13): require_once('D:\\HTTP\\WP_Site...') #7 D:\HTTP\WP_Sites\Recipes\index.php(17): require('D:\\HTTP\\WP_Site...') #8 {main}
NB my server is a Windows machine running PHP 7.4.19 and MySQL 5.7.21. I mention this as I believe it’s significant; the issue doesn’t occur if I put a .maintenance file onto one of the odd WP sites that I manage on a third party *nix server. My gut feel is that the way Windows uses \ in its path name rather than / in *nix is probably at the root of the issue.
@harishanker on my original post in the support forum https://wordpress.org/support/topic/undefined-function-trailingslashit-when-maintenance-present/ suggests that the issue arises from changeset 54669 https://core.trac.wordpress.org/changeset/54669/
I'll be happy to test any fix on my server using an RC release.
Change History (17)
#1
@
2 years ago
- Component changed from General to I18N
- Milestone changed from Awaiting Review to 6.1.2
This ticket was mentioned in Slack in #core by skithund. View the logs.
2 years ago
This ticket was mentioned in PR #3999 on WordPress/wordpress-develop by @swissspidy.
2 years ago
#10
WP_Textdomain_Registry
: Use rtrim
instead of untrailingslashit
and trailingslashit
directly.
Avoids formatting.php
dependency and thus prevents errors when using wp_load_translations_early()
, for example when in maintenance mode.
Trac ticket: https://core.trac.wordpress.org/ticket/57218
This ticket was mentioned in Slack in #core by costdev. View the logs.
2 years ago
@swissspidy commented on PR #3999:
2 years ago
#12
Let's add a short comment to the file header why both functions cannot be used here. Similar to
Fixed 👍
#13
@
2 years ago
- Owner set to swissspidy
- Resolution set to fixed
- Status changed from new to closed
In 55302:
#14
@
2 years ago
- Keywords fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
Hi @grl570810 and welcome to trac!
I see from the support ticket you were not experiencing this error in WordPress 6.0.x so I've moved this on to the 6.1.2 milestone for visibility.
It's great, thank you, providing the error trace is very helpful.