ItinerisLtd/acf-gutenblocks

Exception in AbstractBladeBlock with ACF 5.8 final

tbruckmaier opened this issue ยท 5 comments

Since upgrading to ACF 5.8, an Exception is thrown (5.8-RC2 was working fine)

Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Argument 1 passed to Itineris\AcfGutenblocks\Util::Itineris\AcfGutenblocks\{closure}() must be of the type string, null given in /var/www/html/wp-content/plugins/acf-gutenblocks/src/Util.php:16

Apparently className in AbstractBladeBlock::renderBlockCallback() is no longer an empty string but null, which screws the type declaration of the anonymous function in Util::sanitizeHtmlClasses().

The issue can be fixed by removing the type declaration and casting the variable to a string inside the anonymous method

Got this with ACF Pro 5.8

Undefined index: className in /acf-gutenblocks/src/AbstractBlock.php on line 38
Apparently, when empty $block['className'] is not set.

Got this with ACF Pro 5.8

Undefined index: className in /acf-gutenblocks/src/AbstractBlock.php on line 38
Apparently, when empty $block['className'] is not set.

Same here with ACF Pro 5.8.
I'm getting a similar Notice when trying to use "AbstractBladeBlock"
Notice: Undefined index: className in /acf-gutenblocks/src/AbstractBladeBlock.php on line 32

Then a Fatal Error
Fatal error: Uncaught TypeError: Argument 1 passed to Itineris\AcfGutenblocks\Util::Itineris\AcfGutenblocks{closure}() must be of the type string, null given in /acf-gutenblocks/src/Util.php on line 16

I have updated the pull request to fix these notices too, @nicksull @alfacommunication-alessandro could you test the changes and confirm that they fix the errors/notices?

@tbruckmaier

Fix confirmed!
Thanks

@tbruckmaier confirmed! Thank you!!