• Resolved jimbox1985

    (@jimbox1985)


    Hello,
    I’m actually work on a theme and i got problem if i change my php version from 7.0 to 7.1 , even 7.2, .3 and .4 … it seems to work only with 7.0 or lower.
    Theme broke right after <html and i notice problem is caused, probably, for language_attributes() … maybe i miss some function? i look inside general-template file and everything seem to be ok. Someone have idea of what is happening? Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator bcworkz

    (@bcworkz)

    My test site is using 7.2.24 and there are no issues with language attributes, both English and German languages work fine for me.

    Does your error log give any more specific clues about what went wrong?

    It could be your theme or a plugin might have improperly hooked into the process. If you switched to a default twenty* theme and deactivated all plugins, you then should have no trouble with any PHP version (except maybe 8.0 or really really old). Restore your normal configuration, one at a time, to determine which module was the cause.

    Thread Starter jimbox1985

    (@jimbox1985)

    Thanks for your replay. I will take a look to the log when come back to the office.
    Anyway, problem can be the doctype or the html type?
    Because what i see when i switch to php 7.1 and + is a blank page and by view the source I notice that the page source stop after <html
    This is what I see :
    <!DOCTYPE>
    <html

    so the page source stop right before lang=“en” … That’s what make me think about language attribute… maybe some function that is not working properly in function.php…
    Anyway I will take a look to the log and let you know ??

    Thread Starter jimbox1985

    (@jimbox1985)

    Here is.,
    As I though, something with language_attributes cause the problem. I dont know if problem is closely bound to that, but sure is something around it. Here’s what i get from error log :

    [Tue Feb 02 05:05:39.893168 2021] [lsapi:error] [pid 3883382:tid 140348714063616] [client 5.89.122.223:53410] [host x.com] Backend fatal error: PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function in_category(), 0 passed in /home/a8r31gjube9a/public_html/wp-content/themes/wip_theme/functions.php on line 27 and at least 1 expected in /home/a8r31gjube9a/public_html/wp-includes/category-template.php:255\nStack trace:\n#0 /home/a8r31gjube9a/public_html/wp-content/themes/wip_theme/functions.php(27): in_category()\n#1 /home/a8r31gjube9a/public_html/wp-includes/class-wp-hook.php(289): new_language_attributes(‘lang=”it-IT”‘)\n#2 /home/a8r31gjube9a/public_html/wp-includes/plugin.php(212): WP_Hook->apply_filters(‘lang=”it-IT”‘, Array)\n#3 /home/a8r31gjube9a/public_html/wp-includes/general-template.php(4095): apply_filters(‘language_attrib…’, ‘lang=”it-IT”‘, ‘html’)\n#4 /home/a8r31gjube9a/public_html/wp-includes/functions.php(3485): get_language_attributes()\n#5 /home/a8r31gjube9a/public_html/wp-includes/functions.php(3420): _default_wp_die_handler(‘<div class=”wp-…’, ‘WordPress &rsaq…’, Array)\n#6 /home/a8r31gjube9a/public_html/wp-includes/class-wp-fatal-e in /home/a8r31gjube9a/public_html/wp-includes/category-template.php on line 255\n, referer: x

    Some idea?

    Thread Starter jimbox1985

    (@jimbox1985)

    Thanks,
    i solved for single page, but in archive the error is still there…
    this is my function

    function new_language_attributes($lang){
    if (is_single() || in_category() || is_category()) {
    $ar = get_the_category();
    foreach($ar as $c) {
    if($c->slug==’en’) {
    return “lang=\”en\””;
    }
    }
    }
    return $lang;
    }
    add_filter(‘language_attributes’, ‘new_language_attributes’);

    • This reply was modified 4 years ago by jimbox1985.
    • This reply was modified 4 years ago by jimbox1985.
    Thread Starter jimbox1985

    (@jimbox1985)

    ok, solved. i miss ‘en’ inside is_category()

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Look like language_attributes broke my theme with php 7.2 +’ is closed to new replies.