[wp-trac] [WordPress Trac] #59704: TwentyFifteen: refactor twentyfifteen_fonts_url code for php 8.1
WordPress Trac
noreply at wordpress.org
Mon Oct 23 13:05:31 UTC 2023
#59704: TwentyFifteen: refactor twentyfifteen_fonts_url code for php 8.1
---------------------------+------------------------------
Reporter: jordesign | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Bundled Theme | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
---------------------------+------------------------------
Comment (by SergeyBiryukov):
Hi there, welcome back to WordPress Trac! Thanks for the ticket.
Just noting that a similar fragment also exists in a few other themes:
{{{
$font_stylesheet = str_replace(
array( get_template_directory_uri() . '/',
get_stylesheet_directory_uri() . '/' ),
'',
twentyfifteen_fonts_url()
);
}}}
* Twenty Thirteen
* Twenty Fifteen
* Twenty Sixteen
* Twenty Seventeen
> If twentyfifteen_fonts_url is overwritten and no fonts are returned then
line 184 of functions.php creates a warning as the subject of str_replace
does not exist.
It is worth noting that `twentyfifteen_fonts_url()` is documented to
always return a string. It appears that the original reporter redeclared
the function, but their implementation returns `null` instead of a string,
causing a notice:
{{{
Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type
array|string is deprecated
}}}
If they correct the customized function to always return a string, as the
original does, that should resolve the issue.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59704#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list