Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#34967 closed defect (bug) (fixed)

SHORTINIT and date_i18n: Call to undefined function _x()

Reported by: djzone's profile djzone Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.4.1 Priority: normal
Severity: normal Version: 4.4
Component: Bootstrap/Load Keywords: has-patch fixed-major
Focuses: Cc:

Description

When SHORTINIT is used together with date_i18n() wp-includes/l10n.php is not loaded, and results the following error:

Fatal error: Call to undefined function _x() in /wp-includes
/functions.php on line 178

The following code can be used to reproduce the error:

<?php
define('SHORTINIT', true);
require_once('./wp-load.php');
$now = date_i18n('Y-m-d H:i:s');

This bug appeared in 4.4, with 4.3.1 it worked fine.

I've tried to investigate what happend since 4.3.1 that causes this change, I've find out that it's neither wp-settings.php nor wp-load.php.

I believe a wp_load_translations_early() call somewhere has been moved since 4.3.1, but I could not find that in revision history :(

Attachments (1)

34967.patch (559 bytes) - added by SergeyBiryukov 8 years ago.

Download all attachments as: .zip

Change History (9)

#1 @SergeyBiryukov
8 years ago

  • Milestone changed from Awaiting Review to 4.4.1

Introduced in [35517].

SHORTINIT bails earlier than l10n.php is loaded: tags/4.0/src/wp-settings.php#L101.

Last edited 8 years ago by SergeyBiryukov (previous) (diff)

#2 @SergeyBiryukov
8 years ago

  • Keywords has-patch added

#3 @SergeyBiryukov
8 years ago

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

In 35878:

I18N: In wp_maybe_decline_date(), bail early if translation functions are not available, e.g. in SHORTINIT mode.

Fixes #34967 for trunk.

#4 @SergeyBiryukov
8 years ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

#6 @SergeyBiryukov
8 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 35880:

I18N: In wp_maybe_decline_date(), bail early if translation functions are not available, e.g. in SHORTINIT mode.

Fixes #34967 for trunk.

#7 @SergeyBiryukov
8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#8 @dd32
8 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 36063:

I18N: In wp_maybe_decline_date(), bail early if translation functions are not available, e.g. in SHORTINIT mode.

Merges [35880] to the 4.4 branch.
Props SergeyBiryukov.
Fixes #34967.

Note: See TracTickets for help on using tickets.