Support » Plugin: Download Monitor » Gutenberg – fatal error if block is left ’empty’

  • Resolved hughc

    (@hughc)


    Hi,
    I tripped this today, and can reproduce it.

    Using Gutenberg, I added a ‘download button’ block, did not select a download to associate with it, and then hit ‘update’ to save changes to the post. Got an error toast ‘Update failed’.

    Refreshed the page, and got a 500. Looked at the post I was editing in the front end, got a 500.

    Debug log shows a fatal error, which appears to be an attempt to get the file type of a non-existent file:

    PHP Fatal error: Uncaught Error: Call to a member function get_version() on null in \wp-content\plugins\download-monitor\templates\content-download.php:12
    Stack trace:
    #0 \wp-content\plugins\download-monitor\src\TemplateHandler.php(90): include()
    #1 \wp-content\plugins\download-monitor\src\Gutenberg.php(111): DLM_Template_Handler->get_template_part(‘content-downloa…’, ”, ”, Array)
    #2 \wp-includes\class-wp-block-type.php(109): DLM_Gutenberg->render_download_button(Array, ”)
    #3 \wp-includes\blocks.php(263): WP_Block_Type->render(Array, ”)
    #4 \wp-includes\blocks.php(314): render_block(Array)
    #5 \wp-includes\class-wp-hook.php(286): do_blocks(‘<!– wp:paragra…’)
    #6 \wp-includes\plugin.php(208): WP_Hook->apply in \wp-content\plugins\download-monitor\templates\content-download.php on line 12

    On the front-end, the fatal error is different, but the root cause (an empty file) is the same:

    PHP Fatal error: Uncaught Error: Call to a member function get_the_filetype() on null in \wp-content\themes\projectmanager-2019\download-monitor\content-download.php:10

    The situation was recovered by disabling the plugin, removing the (now orphaned) block, updating the post and then re-enabling it.

    WP 5.2.2
    DLM 4.4.2
    working on localhost under Win10

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Gutenberg – fatal error if block is left ’empty’’ is closed to new replies.