• Resolved Oleg Komarovskyi

    (@komarovski)


    Hello,

    When I’m switching to PHP 8.0, 8.1, 8.2 ajax search doesn’t work and in console log I see error: jquery-3-6-0.min.js response 500

    When I’m switching back to PHP 7.4 everything’s working fine.

    Here’s how I enqueue my scripts in functions.php

    function load_scripts(){
    wp_deregister_script('jquery');
    wp_register_script('jquery', get_template_directory_uri().'/js/jquery-3-6-0.min.js');
    wp_enqueue_script('jquery');
    wp_enqueue_script('lightslider-script', get_template_directory_uri().'/js/lightslider.min.js', array('jquery'));
    }
    add_action('wp_enqueue_scripts', 'load_scripts');

    Can you please fix this issue?

    WP Version: 6.1.1
    WC Version: 7.3.0
    Plugin Version: 2.71

    Thanks!

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

    (@mihail-barinov)

    Hi,

    Please check that the path to jquery-3-6-0.min.js file is correct.

    Also – can you temporarily disable this code snippet and check if this issue with PHP 8.0+ still exists?

    Regards

    Thread Starter Oleg Komarovskyi

    (@komarovski)

    Hey Mikhail,

    I’ve tried to disable my own ‘jquery-3-6-0.min.js’ and get same error, but this time it’s default wordpress ‘jquery.min.js’ file.

    Here, you can test on this website (search form at very top): https://antik.ua

    When you open website everything’s ok, jquery is working, but when you start to type something in search form, then in console log browser gives this error:

    POST https://antik.ua/?wc-ajax=aws_action 500 jquery-3-6-0.min.js:2

    And for default wordpress jquery same error but with different name of jquery file.

    POST https://antik.ua/?wc-ajax=aws_action 500 jquery.min.js:2

    Both files are exist on hosting:

    https://antik.ua/wp-content/themes/antik/js/jquery-3-6-0.min.js:2

    https://antik.ua/wp-includes/js/jquery/jquery.min.js

    Current PHP version is 8.2.1.

    Plugin Author ILLID

    (@mihail-barinov)

    As I see plugin search response return some server error instead of search results.

    Please try the following – enable debug mode like described in this article. Then try to search one more time and after check your debug.log file for any errors inside it.

    Regards

    Thread Starter Oleg Komarovskyi

    (@komarovski)

    Hey Mikhail, this is what I get in log:

    2023-02-08T08:26:50+00:00 CRITICAL Uncaught AssertionError: detected in parse_language_info - cancelled by can_redirect, url_info={
    "cookie_lang_front": "ru",
    "cookie_front_or_admin_found": true,
    "scheme": "https",
    "host": "antik.ua",
    "path": "\/",
    "query": "wc-ajax=aws_action",
    "path-base": "",
    "doing_front_end": true,
    "wp-path": "\/",
    "language": "ru",
    "doredirect": "detected in parse_language_info - cancelled by can_redirect",
    "set_cookie": true
    } in /home/antikua/antik.ua/www/wp-content/plugins/qtranslate-xt/qtranslate_core.php:102
    Stack trace:
    
    0 /home/antikua/antik.ua/www/wp-content/plugins/qtranslate-xt/qtranslate_core.php(102): assert(false, 'detected in par…')
    
    1 /home/antikua/antik.ua/www/wp-includes/class-wp-hook.php(308): qtranxf_init_language('')
    
    2 /home/antikua/antik.ua/www/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
    
    3 /home/antikua/antik.ua/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    
    4 /home/antikua/antik.ua/www/wp-settings.php(480): do_action('plugins_loaded')
    
    5 /home/antikua/antik.ua/www/wp-config.php(100): require_once('/home/antikua/a…')
    
    6 /home/antikua/antik.ua/www/wp-load.php(50): require_once('/home/antikua/a…')
    
    7 /home/antikua/antik.ua/www/wp-blog-header.php(13): require_once('/home/antikua/a…')
    
    8 /home/antikua/antik.ua/www/index.php(17): require('/home/antikua/a…')
    
    9 {main}
    
    thrown in /home/antikua/antik.ua/www/wp-content/plugins/qtranslate-xt/qtranslate_core.php on line 102

    Looks like multilanguage plugin qTranslateXT produce this error (https://github.com/qtranslate/qtranslate-xt).

    Plugin Author ILLID

    (@mihail-barinov)

    As I see from the log file the issue is caused by the qtranslate plugin.

    Please tell me – do you know if qtranslate plugin settings provide some option to exclude some URLs from its language redirections?

    Regards

    Thread Starter Oleg Komarovskyi

    (@komarovski)

    I’m marking this topic as resolved, since its the problem of the qTranslate-XT plugin.

    If someone’s need a fix – just comment assert() function on the line 102 in qtranslate_core.php. This check doesn’t need in production only for debugging.

    PS: The problem was existed in PHP 7.4 too, but everything was worked just because PHP 7.4 and lower versions throws warning message in case of failure, and PHP8+ throws exception. Explanation of how assert() function work in PHP8+ https://php.watch/versions/8.0/assert-throws

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘AJAX Doesn’t Work Under PHP8+’ is closed to new replies.