[wp-trac] [WordPress Trac] #62564: Wrong warning about _load_textdomain_just_in_time used incorrectly if $theme->__toString() is called in plugin initialization

WordPress Trac noreply at wordpress.org
Mon Nov 25 13:03:10 UTC 2024


#62564: Wrong warning about _load_textdomain_just_in_time used incorrectly if
$theme->__toString() is called in plugin initialization
--------------------------+-----------------------------
 Reporter:  DaveFX        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.7
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 One of my installed plugins has these lines in its initialization
 function:

 {{{#!php
 <?php
 $current_theme = wp_get_theme();

 if ('Flatsome' == $current_theme) {
   // Do something
 } else {
   // Do a different thing
 }
 }}}

 The issue here is that the implicit **\_\_toString()** call in the theme
 class ultimately calls
 {{{
 translate("My Child Theme Name","my-theme-name")
 }}}

 which generates a wrong warning about _load_textdomain_just_in_time used
 incorrectly, saying that the culprit is the theme code, when the
 backtraces shows this is not the case.

 I honestly think this is an issue from WordPress Core, as this **_
 _toString()** call to get the theme name shouldn't ever generate this
 warning.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62564>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list