Support » Plugin: Asset CleanUp: Page Speed Booster » Fatal error: undefined function WpAssetCleanUp\json_last_error()

  • Resolved Jelle Roorda

    (@jifuss)


    Hi Gabriel,

    I just installed the latest version of the plugin (1.3.2.6) on WordPress 5.1.1 (at time of writing also the latest version).

    After I installed the plugin, and switched on the “I’ve read and understood the use of this plugin” (or something like that), and pressed the “save” button, I got the error below. Sadly, I had to remove the plugin again to get the site to function again. From the error it seems a function is missing from the main plugin class (maybe a slight mistake during checking in the code on the SVN repository?.

    Please give me a heads up after you’ve found the time to fix it, since the plugin is very helpful!

    If you’d like me to investigate the issue any further feel free to let me know.

    
    Fatal error: Uncaught Error: Call to undefined function WpAssetCleanUp\json_last_error() in USER_DIRECTORY/wp-content/plugins/wp-asset-clean-up/classes/Settings.php:262
    Stack trace: 
    #0 USER_DIRECTORY/wp-content/plugins/wp-asset-clean-up/classes/Main.php(237): WpAssetCleanUp\Settings->getAll()
    #1 USER_DIRECTORY/wp-includes/class-wp-hook.php(286): WpAssetCleanUp\Main->triggersAfterInit('')
    #2 USER_DIRECTORY/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
    #3 USER_DIRECTORY/wp-includes/plugin.php(465): WP_Hook->do_action(Array)
    #4 USER_DIRECTORY/wp-settings.php(505): do_action('init')
    #5 USER_DIRECTORY/wp-config.php(92): require_once('/home/cizapeo34...') 
    #6 /home/cizapeo342/domains/fortranbigirimana in USER_DIRECTORY/wp-content/plugins/wp-asset-clean-up/classes/Settings.php on line 262
    
    • This topic was modified 1 month ago by  Jelle Roorda. Reason: Added plugin version for explicity and better debugging
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Gabe Livan

    (@gabelivan)

    Hello, Jelle!

    The function json_last_error() is available from PHP 5.3 and if you didn’t get an error when you activated the plugin, then you’re likely using a higher version (which is strongly recommended). It could be that you’re in a rare situation where the configuration of the PHP on your server doesn’t have the JSON extension enabled.

    What’s the hosting company you’re using? Can you verify through a php.ini check or via your hosting control panel if the extension is enabled? I have to admit this is very rare and you might have issues with other plugins or themes as well.

    PS: I initially thought the error is due to the namespace, but I’ve checked the code and all is looking good and no one ever reported such an error so far. Here’s the same issue discussed here regarding a different plugin where they suggest the same fix: https://wordpress.org/support/topic/problem-after-5-1-1-upgrade/

    • This reply was modified 1 month ago by  Gabe Livan.
    Plugin Author Gabe Livan

    (@gabelivan)

    @jifuss I’ve added a fallback in case json_last_error() is not defined. Can you please re-download the plugin and see if works now?

    Hi @gabelivan, thanks for your reply!

    I re-downloaded the plugin, and the issue seems to be fixed (without enabling the json extension, which was disabled as you guessed).

    I’ll enable the json extension just to make sure I won’t be experiencing any unnecessary errors in the future!

    Thanks a bunch for your quick reply and resolution, really appreciated!

    Plugin Author Gabe Livan

    (@gabelivan)

    @jifuss cool! Looking forward to your feedback regarding the plugin! I hope it will strip the “fat” from your website 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.