• Resolved Andrew Miguelez

    (@andrewmiguelez)


    When activating the plugin and testing the front-end, the following error is displayed in the footer of my theme where the JS files should be:

    Fatal error: __clone method called on non-object in /home/USERNAME/public_html/wp-includes/load.php on line 687

    This is not the case when I am logged in and have the Admin Toolbar enabled. The error only occurs when I am logged out or have the toolbar disabled.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author launchinteractive

    (@launchinteractive)

    Hi Andrew,

    Have you tried it with the 2016 theme?
    Also, do you have any other caching plugins enabled?

    Thread Starter Andrew Miguelez

    (@andrewmiguelez)

    I just verified that the issue was occurring on my local environment too so I could do some testing there. I installed the Twenty Sixteen theme and activated it. The issue was gone. And back again when I re-activated my custom theme. So this is definitely something related to my theme/JS files/enqueuing in functions.php.

    Not really sure where to begin. Any advice?

    The live site is: https://andrewmiguelez.com
    I did not have any caching plugins at the time of my original post. I have now activated WP Super Cache. I want to give your plugin a chance, so I’m holding off on testing any others at this time.

    Plugin Author launchinteractive

    (@launchinteractive)

    I’d try maybe disabling all plugins except for MMR and see if the problem remains but it does sound like a theme issue. Maybe rename functions.php to _functions.php to disable it.. and see if the issue remains. If thats the case then your going to have to work your way through functions.php to see what is causing the issue.

    If you can grant me access to your local/staging environment I may be able to have a look.

    Thread Starter Andrew Miguelez

    (@andrewmiguelez)

    I renamed functions.php and deactivated all other plugins, but the error persists. This has got to be some strange bug. I’m going to start messing with all theme files to see if I can simplify the page until the error disappears.

    I’m not able to grant you access to local. If I can’t get it figured out, I’ll setup a staging site on a subdomain that you can get into.

    Thread Starter Andrew Miguelez

    (@andrewmiguelez)

    I have modified my index.php theme file to the following:

    <?php
    wp_head();
    wp_footer();

    functions.php file is renamed, all other plugins are deactivated. Error still exists.

    If I remove wp_head() from index.php, the error is gone. But as I am no longer affecting either the head or foot of my theme with functions.php, I don’t know why this is happening.

    Plugin Author launchinteractive

    (@launchinteractive)

    If you want to email me a copy of your theme I can have a play with it and see if it errors on my staging.

    Thread Starter Andrew Miguelez

    (@andrewmiguelez)

    I have created a new theme from scratch. Added a style.css file with a theme name, an empty functions.php file, and an index.php file resembling the one I described in my last post.

    The error still exists, even when I wait to install and activate the MMR plugin after activating my test theme.

    I’m completely stumped. It’s not even the database, because the error isn’t occuring when switching to a default theme. Sheesh…

    Plugin Author launchinteractive

    (@launchinteractive)

    could you send me that test theme you made? I’ll have a look and see if I can replicate it.

    Thread Starter Andrew Miguelez

    (@andrewmiguelez)

    I just sent you the test theme in a ZIP.

    I have pinpointed the cause of the error. MMR is unable to overlook a lack of enqueued stylesheets. You need to call wp_enqueue_style() at least once in order to avoid the Fatal Error.

    My custom theme has a hard-coded stylesheet in header.php so I have not enqueued any stylesheets yet. I was planning on transitioning that over once I got a minification plugin working. Hopefully you’ll be able to identify and fix the areas in your plugin that are causing this so weirdos like me won’t see errors anymore.

    Plugin Author launchinteractive

    (@launchinteractive)

    Hey Andrew, Thanks for this. I’ve updated MMR and just released the new version. Let me know if you have any more issues.

    Thread Starter Andrew Miguelez

    (@andrewmiguelez)

    Thanks, Marc.

    I can confirm that the plugin update fixes the issue. I really appreciate the time you spent with me, diagnosing and correcting the error I was experiencing. Merge + Minify + Refresh is a very good plugin and backed by a great developer. I will definitely be using it in more projects moving forward.

    For those following along…
    The issue I was having was most likely due to my combination of Apache & PHP (older PHP version specifically). My WP install didn’t like when MMR tried to use data about enqueued styles that didn’t exist. The developer’s fix was to invoke wp_styles() and wp_scripts() before attempting to use their data. This alleviated my issue because WP then created the necessary objects relating to enqueued styles even though none existed. No more errors!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Fatal Error where scripts in footer should be’ is closed to new replies.