Translation loading for the riverbank domain is triggered too early (WordPress 6.7+)

Aperta Adatta ai principianti
#133 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php

Direzione di ricerca

Inizia dalla classe Block_Patterns: il suo costruttore e il metodo run(), più la chiamata Core::get_instance() in functions.php che attiva il caricamento anticipato. Riproduci su WordPress 6.7+ con WP_DEBUG_LOG attivo e controlla wp-content/debug.log per l'avviso _load_textdomain_just_in_time. Completato quando una richiesta con un file di traduzione riverbank non registra alcun avviso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

On WordPress 6.7 and later, every request on a site that has a Riverbank translation logs:

PHP Notice:  Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the riverbank domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. (This message was added in version 6.7.0.)

Cause: functions.php calls Core::get_instance() while the theme loads. The Core constructor creates Block_Patterns, whose constructor calls setup_properties(), which runs __( 'Riverbank Patterns', 'riverbank' ) before after_setup_theme.

Fix: the same as Jaxon 1.0.9 (Codeinwp/jaxon commit c7f8818) and Neve FSE (Codeinwp/neve-fse#170): move $this->setup_properties(); from Block_Patterns::__construct() into run(), which runs on init.

Reproduce:

  1. WordPress 6.7 or later with WP_DEBUG and WP_DEBUG_LOG on, Riverbank 1.0.18 active.
  2. Put any translation file for the theme at wp-content/languages/themes/riverbank-<locale>.mo and use that locale (an empty riverbank-en_US.mo on an English site is enough).
  3. Load any page.

Expect: no notice. Actual: the notice above in wp-content/debug.log on every request.

Found by the WordPress compatibility routine (Codeinwp/qa-compatibility): Riverbank 1.0.12 logs nothing on WordPress 6.6.12 and logs the notice on 6.7; 1.0.18 logs it on 7.0.8, 7.1.5 and 7.2-RC2.

Lingua principale
PHP
Stelle
2
Fork
0
Merge medio
4h 59m
PR unite (30g)
5

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Codeinwp/riverbank

Tutte le issue di Codeinwp/riverbank

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.