Description
The the_post callback in includes/block-migrate/loader.php:29 declares its parameter as pass-by-reference:
function( WP_Post &$post ) {
WordPress's WP_Hook::apply_filters() passes arguments by value, so this generates a warning on every page load under PHP 8.x:
PHP Warning: CoBlocks::{closure}(): Argument #1 ($post) must be passed by reference, value given in wp-includes/class-wp-hook.php on line 343
Steps to Reproduce
- Activate CoBlocks on PHP 8.x
- Visit any post/page on the frontend
- Check the error log
Fix
Remove the & from the closure parameter. Since WP_Post is an object, it's already passed by handle — the reference is unnecessary.
- function( WP_Post &$post ) {
+ function( WP_Post $post ) {
Environment
- CoBlocks 3.1.17
- PHP 8.3
- WordPress 6.7
Description
The
the_postcallback inincludes/block-migrate/loader.php:29declares its parameter as pass-by-reference:WordPress's
WP_Hook::apply_filters()passes arguments by value, so this generates a warning on every page load under PHP 8.x:Steps to Reproduce
Fix
Remove the
&from the closure parameter. SinceWP_Postis an object, it's already passed by handle — the reference is unnecessary.Environment