• Resolved Aurélien Denis


    Just uptaded to 3.4 and get these PHP errors:

    Warning: Invalid argument supplied for foreach() in /wp-content/plugins/weglot/src/services/class-language-service-weglot.php on line 105
    Warning: Invalid argument supplied for foreach() in /wp-content/plugins/weglot/src/services/class-language-service-weglot.php on line 147
    Fatal error: Uncaught Error: Call to a member function getExternalCode() on null in /wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Util/Url.php:271 Stack trace: #0 /wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Util/Url.php(93): Weglot\Util\Url->detectUrlDetails() #1 /public_html/wp-content/plugins/weglot/src/services/class-request-url-service-weglot.php(65): Weglot\Util\Url->__construct('https://...', NULL, Array, NULL, Array, NULL) #2 /wp-content/plugins/weglot/src/helpers/class-helper-filter-url-weglot.php(26): WeglotWP\Services\Request_Url_Service_Weglot->create_url_object('https://...') #3 /wp/wp-includes/class-wp-hook.php(303): WeglotWP\Helpers\Helper_Filter_Url_Weglot::filter_url_lambda('https://...') #4 /wp/wp-includes/plugin.php(189): WP_Hook->apply_filters('https://...', Array) #5 /wp-c in /wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Util/Url.php on line 271

    FYI WordPress is install in /wp with Composer.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Remy B


    Hi Aurélien,

    Did you upgrade from 3.3.6 or from an earlier version ?
    Also, do you have custom code calling Weglot function or does this error comes from Weglot code only.
    Finally, can you go in Weglot settings page and save the settings again to refresh and make sure settings are properly set


    Thread Starter Aurélien Denis


    Hi Remy,
    it’s an old project and it seems that it was Weglot 3.2.0. No custom code here.
    I tried to re-install the plugin but settings don’t want to save.



    Chiming in here too, that this occurs for one of our sites upon logging out of wordpress:

    error was caught (/wp-login.php?action=logout&_wpnonce=1cf71b801c)

    Error Details
    An error of type E_ERROR was caused in line 271 of the file wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Util/Url.php. Error message: Uncaught Error: Call to a member function getExternalCode() on null in wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Util/Url.php:271
    Stack trace:
    #0 wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Util/Url.php(93): Weglot\Util\Url->detectUrlDetails()
    #1 wp-content/plugins/weglot/src/services/class-request-url-service-weglot.php(65): Weglot\Util\Url->__construct('https://www.dif...', NULL, Array, NULL, Array, NULL)
    #2 wp-content/plugins/weglot/src/helpers/class-helper-filter-url-weglot.php(46): WeglotWP\Services\Request_Url_Service_Weglot->create_url_object('https://www.dif...')
    #3 wp-includes/class-wp-hook.php(305): WeglotWP\Helpers\Helper_Filter_Url_Weglot::filter_url_log_redirect('https://www.dif...')
    #4 wp-includes/plugin.php(189): WP_Hook->apply_filters('https://www.dif...', Array)
    #5 /home/dif
    Plugin Author Remy B


    @maigret I’ve seen this error a long time ago when switching from 3.2
    Usually to fix it, you go in the Weglot settings, check the API key, original language and destination language save the settings.
    Try 2 times and tell me

    Thread Starter Aurélien Denis


    @remyb92 it works now! The API key wasn’t correct, I create the project website in Weglot account, copy and paste the new key and it’s ok.


    Plugin Author Remy B


    ok perfect!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Fatal error since latest update’ is closed to new replies.