• Hi, when I enable Block Visibility I get a fatal error:

    An error of type E_COMPILE_ERROR was caused in line 89 of the file /[path to plugin]/block-visibility/includes/utils/user-functions.php. Error message: Namespace declaration statement has to be the very first statement or after any declare call in the script

    I’ve disabled *all* plugins and reverted to the Twenty Twenty Five theme, and as soon as I activate the plugin, I get this error. We’re running PHP version 8.2 and WordPress 6.8.1.

    I’m seeing this error from other plugins as well, and I’ve already contacted the other devs; two have issued updates that fix the error, it seems to be a matter of removing whitespace before the namespace declaration.

    Thanks.

    • This topic was modified 7 months, 3 weeks ago by cmerrick.
    • This topic was modified 7 months, 3 weeks ago by cmerrick.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Nick Diego

    (@ndiego)

    Thanks for reporting @cmerrick. I am struggling to replicate the issue on my end using the same settings. That file mentioned in the error message has not been updated in 2 years, so it’s quite curious the issue is appearing now and the way the namespace is declared in the file is correct. Can you share any additional info about your site’s setup?

    Thanks,
    Nick

    Thread Starter cmerrick

    (@cmerrick)

    Hi! I can tell you it’s a site hosted on WP Engine, PHP v 8.2, WP v 6.8.1, Block Visibility v 3.7.1. I just tested again by deactivating every plugin and switching to the Twenty Twenty Five theme, and as soon as I activated BV, I get this fatal error:

    An error of type E_COMPILE_ERROR was caused in line 89 of the file /[path to site]/wp-content/plugins/block-visibility/includes/utils/user-functions.php. Error message: Namespace declaration statement has to be the very first statement or after any declare call in the script

    The PostX plugin had the same problem, and they fixed it by removing whitespace before the namespace declaration.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘fatal error from namespace declaration’ is closed to new replies.