#23555 closed defect (bug) (fixed)
Fatal error when sunrise added
Reported by: | Rahe | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.5.2 | Priority: | low |
Severity: | normal | Version: | 3.5.1 |
Component: | Multisite | Keywords: | has-patch |
Focuses: | Cc: |
Description
Hi,
I have installed a WordPress multisite subdomains on a server. I have added a sunrise.php file on the wp-content folder.
In this file there is a $wpdb->prepare without the needed argument at the end. WordPress throw a _doing_it_wrong() but this launch a Fatal error :
Fatal error: Call to undefined function __() in /home/site/public_html/wp-includes/functions.php
Call Stack: 0.0001 335660 1. {main}() /home/site/public_html/wp-admin/network/settings.php:0 0.0001 335964 2. require_once('/home/site/public_html/wp-admin/network/admin.php') /home/site/public_html/wp-admin/network/settings.php:11 0.0001 336260 3. require_once('/home/site/public_html/wp-admin/admin.php') /home/site/public_html/wp-admin/network/admin.php:13 0.0002 336564 4. require_once('/home/site/public_html/wp-load.php') /home/site/public_html/wp-admin/admin.php:30 0.0002 337136 5. require_once('/home/site/public_html/wp-config.php') /home/site/public_html/wp-load.php:29 0.0002 337500 6. require('/home/site/public_html/wp-config-dev.php') /home/site/public_html/wp-config.php:6 0.0003 339004 7. require_once('/home/site/public_html/wp-settings.php') /home/site/public_html/wp-config-dev.php:109 0.0037 791980 8. require('/home/site/public_html/wp-includes/ms-settings.php') /home/site/public_html/wp-settings.php:87 0.0038 793784 9. include_once('/home/site/public_html/wp-content/sunrise.php') /home/site/public_html/wp-includes/ms-settings.php:18 0.0039 795552 10. wpdb->prepare() /home/site/public_html/wp-content/sunrise.php:41 0.0039 795872 11. _doing_it_wrong() /home/site/public_html/wp-includes/wp-db.php:995
Is this normal that the translations function are not available ?
Attachments (4)
Change History (15)
#1
@
11 years ago
- Version changed from 3.5.1 to 3.0
sunrise.php
is included in ms-settings.php
, which is loaded earlier than l10n.php
:
http://core.trac.wordpress.org/browser/tags/3.5.1/wp-settings.php#L84
http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/ms-settings.php#L17
#2
@
11 years ago
The _doing_it_wrong()
call added in [23215] for 3.5.1 made the issue more prominent.
However, __()
is only called if WP_DEBUG
is true and the notices aren't disabled via a plugin:
http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/functions.php#L2955
#3
@
11 years ago
There's a discussion in #21204 whether we should translate the _doing_it_wrong()
messages.
#4
@
11 years ago
- Milestone changed from Awaiting Review to 3.5.2
- Priority changed from normal to low
- Version changed from 3.0 to 3.5.1
#5
@
11 years ago
- Cc chacha102 added
Would it make sense in this case to add a check to _doing_it_wrong() to only translate if l10n.php has been loaded? That way in the few cases where it is called prior to l10n.php, it would be printed in English, and everywhere else translated correctly?
#6
@
11 years ago
- Keywords has-patch added
23555.patch just checks if __()
exists and does nothing otherwise.
23555.2.patch checks if __()
exists and falls back to untranslated strings if it doesn't.
We have a similar check in _default_wp_die_handler()
: [6110], [11342].
The sunrise file