Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#23555 closed defect (bug) (fixed)

Fatal error when sunrise added

Reported by: rahe's profile Rahe Owned by: nacin's profile nacin
Milestone: 3.5.2 Priority: low
Severity: normal Version: 3.5.1
Component: Multisite Keywords: has-patch
Focuses: Cc:



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) (8.6 KB) - added by Rahe 11 years ago.
The sunrise file
sunrise.php (6.4 KB) - added by Rahe 11 years ago.
The right sunrise file
23555.patch (912 bytes) - added by SergeyBiryukov 11 years ago.
23555.2.patch (1.5 KB) - added by SergeyBiryukov 11 years ago.

Download all attachments as: .zip

Change History (15)

11 years ago

The sunrise file

11 years ago

The right sunrise file

#1 @SergeyBiryukov
11 years ago

  • Version changed from 3.5.1 to 3.0

#2 @SergeyBiryukov
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:

#3 @SergeyBiryukov
11 years ago

There's a discussion in #21204 whether we should translate the _doing_it_wrong() messages.

#4 @nacin
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 @chacha102
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 @SergeyBiryukov
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].

#7 @ryan
11 years ago

Fine with 23555.2.patch​.

#8 @nacin
11 years ago

Not the cleanest solution but it'll do.

#9 @nacin
11 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 24439:

Fall back to non-translated strings in _doing_it_wrong() if the translation function doesn't exist. This may be the case in sunrise, for example.

props SergeyBiryukov.
fixes #23555.
for trunk.

#10 @nacin
11 years ago

In 24440:

Fall back to non-translated strings in _doing_it_wrong() if the translation function doesn't exist. This may be the case in sunrise, for example.

Merges [24439] to the 3.5 branch.

props SergeyBiryukov.
fixes #23555.

Note: See TracTickets for help on using tickets.