• Resolved peterrmueller

    (@peterrmueller)


    As of yesterday, Advanced Accordion Block 4.1.0 produces a fatal error that kills the WordPress site:

    Parse error: syntax error, unexpected ‘)’ in /home/www/wordpress/wp-content/plugins/advanced-accordion-block/plugin.php on line 105

    I tried deinstalling and installing again, WP refuses to activate the plugin due to this parse error.

    The plugin is being used on this page:
    https://vogelgetwitter.de/birding-beatrix-archiv/

    Wordpress 5.9.3
    PHP 7.1.33

    Having received a message in the WP backend about the PHP version I updated PHP to 7.4 and tried installing the plugin again. After activating, I bet directed to the tools page for Advanced Accordion Blocks and see the following errors on top of that page:

    [translation for the German part at the beginning: WP_Block…has been called with error. The title of the template must be a string. Further information: Debugging in WordPress…]

    Notice: WP_Block_Patterns_Registry::register wurde fehlerhaft aufgerufen. Der Titel der Vorlage muss eine Zeichenfolge sein. Weitere Informationen: Debugging in WordPress (engl.). (Diese Meldung wurde in Version 5.5.0 hinzugefügt.) in /home/www/wordpress/wp-includes/functions.php on line 5775
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/www/wordpress/wp-includes/functions.php:5775) in /home/www/wordpress/wp-includes/functions.php on line 6828
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/www/wordpress/wp-includes/functions.php:5775) in /home/www/wordpress/wp-admin/includes/misc.php on line 1310
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/www/wordpress/wp-includes/functions.php:5775) in /home/www/wordpress/wp-admin/admin-header.php on line 9

    After deactivating AAB the error messages go away. So it appears the plugin is causing those error.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • I got same error fixed by editing function aab_wp_block_patterns the file
    wp-content/plugins/advanced-accordion-block/block-patterns/block-patterns.php

    line 16 add an empty check for $slug. Sometimes this gets called with a null $slug

    function aab_wp_block_patterns( $slug = null, $title = null, $description = null, $content = null ) {
        if(empty($slug)) return false; // check if $slug is empty
        register_block_pattern(
            'block-pattern/' . $slug,
            [
                'categories'  => [
                    'accordion-block'
                ],
                'title'       => __( $title, 'advanced-accordion-block' ),
                'description' => __( $description, 'advanced-accordion-block' ),
                'content'     => $content,
            ]
        );
    }
    add_action( 'init', 'aab_wp_block_patterns',4,10 );

    Update:
    I also have ACF installed. I believe this issue with insert-pages plugin is similar to this plugin. A fix for “insert pages” (from author of that plugin) is here.
    ACF makes multiple calls from the git commit

    some plugins, like Advanced Custom Fields, create a scenario where this init hook gets called multiple times

    https://github.com/uhm-coe/insert-pages/commit/621a76ecd203492556754292b2eaa2d953cb3f96

    I am also having similar problems, receiving the following notice when WP_DEBUG is active:

    “Notice: WP_Block_Patterns_Registry::register was called incorrectly. Pattern title must be a string.”

    I’ve traced the problem to the function aab_wp_block_patterns() in the plugin file block-patterns.php. When doing a var_dump of the $title, after the first four default configs, it is getting called a 5th time from an unknown source (I am also running ACF). This is when it passes null to the $title variable, causing the error. I patched it by adding a check for null or empty $title like vermans’s solution above.

    Plugin Contributor Binsaifullah

    (@binsaifullah)

    thanks for letting me know the issue, I will fix it and update in the next update. thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fatal Error’ is closed to new replies.