[wp-trac] [WordPress Trac] #59318: Block Themes Fatal Error in PHP 8.1 When Referring To Missing Template Parts
WordPress Trac
noreply at wordpress.org
Fri Sep 8 15:27:22 UTC 2023
#59318: Block Themes Fatal Error in PHP 8.1 When Referring To Missing Template
Parts
--------------------------+------------------------------
Reporter: TJNowell | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: 6.3.1
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by TJNowell):
Perhaps if this:
{{{
if ( is_null( $content ) && $is_debug ) {
if ( ! isset( $attributes['slug'] ) ) {
// If there is no slug this is a placeholder and
we dont want to return any message.
return;
}
return sprintf(
/* translators: %s: Template part slug. */
__( 'Template part has been deleted or is
unavailable: %s' ),
$attributes['slug']
);
}
}}}
Was changed to this:
{{{
if ( is_null( $content ) ) {
if ( $is_debug ) {
if ( ! isset( $attributes['slug'] ) ) {
// If there is no slug this is a
placeholder and we dont want to return any message.
return;
}
return sprintf(
/* translators: %s: Template part slug. */
__( 'Template part has been deleted or is
unavailable: %s' ),
$attributes['slug']
);
}
return '';
}
}}}
Then it would degrade gracefully without a PHP deprecation fatal in PHP
8.1
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59318#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list