[wp-trac] [WordPress Trac] #59704: Twenty Fifteen: harden twentyfifteen_fonts_url code for php 8.1

WordPress Trac noreply at wordpress.org
Mon Jan 29 18:41:03 UTC 2024


#59704: Twenty Fifteen: harden twentyfifteen_fonts_url code for php 8.1
---------------------------+------------------------------
 Reporter:  jordesign      |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Bundled Theme  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------

Comment (by sabernhardt):

 Or for a smaller change, casting it as a string seems to prevent the
 error.

 {{{
                 $font_stylesheet = str_replace(
                         array( get_template_directory_uri() . '/',
 get_stylesheet_directory_uri() . '/' ),
                         '',
                         (string) twentyfifteen_fonts_url()
                 );
 }}}

 (The type cast is used for `strpos()` in `twentyfifteen_scripts()` and
 `twentyfifteen_block_editor_styles()`, and those functions did not cause
 an error.)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59704#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list