• amcnicoll

    (@amcnicoll)


    Hi,

    Version: Community 3.3.6

    On upgrading PHP to 8+, I get an error message at the top of all screens with the message that constant ‘EMD_ADMIN_DIR’ is already defined. This then in turn throws an error that “headers have already been sent”.

    I believe that EMD is a templating system, and therefore other plugins may legitimately set it too. With that in mind, I have changed line 97 of youtube-showcase.php from

    define('EMD_ADMIN_DIR', ABSPATH . 'wp-admin');

    to

    if (!defined('EMD_ADMIN_DIR')) { define('EMD_ADMIN_DIR', ABSPATH . 'wp-admin'); }

    Unless I’m missing something, this should be an easy fix to roll out. The other constants defined there are specific to Youtube Showcase and so shouldn’t cause issues. All other declarations of potential duplicate EMD items (e.g. classes, functions) seem to be prefaced with if statements to prevent redeclaration.

  • The topic ‘Redefined constant gives errors in PHP 8+’ is closed to new replies.