• Resolved Hlsg

    (@hlsg)


    As follows:

    Fatal error: Cannot redeclare convert_stats() (previously declared in .../wp-content/plugins/png-to-jpg/png-to-jpg.php:37) in /var/www/dev/dev6/wp-content/plugins/png-to-jpg/png-to-jpg.php on line 37

    I’m on PHP 7.2.11 in a Vagrant environment which otherwise works flawlessly.

    Thank you!

    • This topic was modified 5 years, 9 months ago by Hlsg.
Viewing 5 replies - 1 through 5 (of 5 total)
  • What Vagrant environment are you using?

    Looks like the plugin is being loaded twice. Any chance you have a theme functions file that is trying to load this? Or What other plugins are you using?

    In the error message, regarding the ellipses in previously declared in .../wp-content, did you redact that or was that the error message? If you did redact it, was it previously /var/www/dev/dev6 or something else?

    Thread Starter Hlsg

    (@hlsg)

    The environment is ubuntu-16.04 with PHP 7.2.11.

    I’ve disabled all other plugins and the error persists.

    I’ve also done a search on all teh files in the project for convert_stats and only the instances in png-to-jpg.php came up:

       37: 			function convert_stats( $content ){
       41: 			ob_start( 'convert_stats' );

    The “…” part is redacted from /var/www/dev/dev6 ideed. I forgor to redact the second instance, but they were identical.

    Fatal error: Cannot redeclare convert_stats() (previously declared in /var/www/dev/dev6/wp-content/plugins/png-to-jpg/png-to-jpg.php:37) in /var/www/dev/dev6/wp-content/plugins/png-to-jpg/png-to-jpg.php on line 37

    Thank you!

    • This reply was modified 5 years, 9 months ago by Hlsg.
    Plugin Author kubiq

    (@kubiq)

    Thanks @mikeschinkel for help!

    Thread Starter Hlsg

    (@hlsg)

    This is not solved, so please don’t mark it as such. I have figured out what code in my theme is conflicting with your plugin and it doesn;t seem to me that it should. It’s just adding some custom separators to the admin menu.

    
    add_action( 'admin_init', 'custom_add_admin_menu_separator' );
    function custom_add_admin_menu_separator( $position ) {
    
        global $menu;
        $menu[ $position ] = array(
            0   =>  '',
            1   =>  'read',
            2   =>  'separator' . $position,
            3   =>  '',
            4   =>  'wp-menu-separator'
        );
    
    }
    
    add_action( 'admin_menu', 'custom_set_admin_menu_separator' );
    function custom_set_admin_menu_separator() {
        do_action( 'admin_init', "25.1" );
        do_action( 'admin_init', "35.1" );
    }
    

    Any ideas?

    Plugin Author kubiq

    (@kubiq)

    I’m sure this has no conflict with my plugin

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fatal error on plugin activation’ is closed to new replies.