[wp-trac] [WordPress Trac] #59318: Block Themes: PHP 8.1 Deprecation notice passing null to non-nullable when referring to missing template parts
WordPress Trac
noreply at wordpress.org
Thu Jun 13 21:32:27 UTC 2024
#59318: Block Themes: PHP 8.1 Deprecation notice passing null to non-nullable when
referring to missing template parts
-------------------------------------------------+-------------------------
Reporter: TJNowell | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.6
Component: Themes | Version: 6.3.1
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests php81 | Focuses: php-
gutenberg-merge | compatibility
-------------------------------------------------+-------------------------
Comment (by hellofromTonya):
I opened an issue in Gutenberg for the PHP Warning being thrown, as noted
in my test report comment:15
>As @poena originally reported in the fix's PR, there is another issue
with a higher error level:
>
>>Warning: Attempt to read property "content" on null in ../wp-
includes/blocks/template-part.php on line 73
>
>This happens because `$block_template` is being used as an object when
`get_block_file_template()` returns `null`. An additional guard check is
needed.
>
>This issue will need a separate fix. It'll need a separate Gutenberg
issue and fix as well as tests.
https://github.com/WordPress/gutenberg/issues/62559
The fix will need to happen in Gutenberg first, as the function is
maintained within its package, i.e. `packages/block-library/src/template-
part/index.php` file.
https://github.com/WordPress/gutenberg/blob/ee30a87abd733d00338730eed831cfc02d27edf0/packages
/block-library/src/template-part/index.php#L117
I'd also suggest the unit test be created with the fix. When ready, both
changes can be merged into Core with a package update.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59318#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list