Importante

Você está vendo a versão anterior da nova experiência da Alura que estamos preparando para você. Em breve, ela ganha uma identidade visual novinha totalmente pensada em potencializar seus estudos!

23
respostas

Error

Boa noite, estou usando as mesmas configurações, mas estou com esses erros.

Warning: Parameter 1 to wp_default_scripts() expected to be a reference, value given in /storage/ssd3/704/7819704/public_html/wp-includes/plugin.php on line 601

Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /storage/ssd3/704/7819704/public_html/wp-includes/plugin.php on line 601
23 respostas

Cola o código aí pra gente analisar.

function do_action_ref_array($tag, $args) {
    global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;

    if ( ! isset($wp_actions[$tag]) )
        $wp_actions[$tag] = 1;
    else
        ++$wp_actions[$tag];

    // Do 'all' actions first
    if ( isset($wp_filter['all']) ) {
        $wp_current_filter[] = $tag;
        $all_args = func_get_args();
        _wp_call_all_hook($all_args);
    }

    if ( !isset($wp_filter[$tag]) ) {
        if ( isset($wp_filter['all']) )
            array_pop($wp_current_filter);
        return;
    }

    if ( !isset($wp_filter['all']) )
        $wp_current_filter[] = $tag;

    // Sort
    if ( !isset( $merged_filters[ $tag ] ) ) {
        ksort($wp_filter[$tag]);
        $merged_filters[ $tag ] = true;
    }

    reset( $wp_filter[ $tag ] );

    do {
        foreach ( (array) current($wp_filter[$tag]) as $the_ )
            if ( !is_null($the_['function']) )
                call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));

    } while ( next($wp_filter[$tag]) !== false );

    array_pop($wp_current_filter);
}

Faltou uma chave nessa linha

 if ( ! isset($wp_actions[$tag]) )

Não achei essa linha, nesse bloco que mandei não está faltando nada

É a terceira linha com conteudo escrito.

Você escreveu :

 if ( ! isset($wp_actions[$tag]) )

mas o correto é

 if ( ! isset($wp_actions[$tag]) ) {

E você tem que fechar esse bloco de if também. Logo abaixo da linha com conteudo escrito 6.

  ++$wp_actions[$tag];

Fecha com a chave }

Agora tá dando error na linha 603

function do_action_ref_array($tag, $args) {
    global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;

    if ( ! isset($wp_actions[$tag]) ){
        $wp_actions[$tag] = 1;
    }
    else{
        ++$wp_actions[$tag];
    }
    // Do 'all' actions first
    if ( isset($wp_filter['all']) ) {
        $wp_current_filter[] = $tag;
        $all_args = func_get_args();
        _wp_call_all_hook($all_args);
    }

    if ( !isset($wp_filter[$tag]) ) {
        if ( isset($wp_filter['all']) )
            array_pop($wp_current_filter);
        return;
    }

    if ( !isset($wp_filter['all']) ){
        $wp_current_filter[] = $tag;
    }

    // Sort
    if ( !isset( $merged_filters[ $tag ] ) ) {
        ksort($wp_filter[$tag]);
        $merged_filters[ $tag ] = true;
    }

    reset( $wp_filter[ $tag ] );

    do {
        foreach ( (array) current($wp_filter[$tag]) as $the_ ){
            if ( !is_null($the_['function']) ){
                call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
            }
        }

    } while ( next($wp_filter[$tag]) !== false );

    array_pop($wp_current_filter);
}

E aqui também

Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd3/704/7819704/public_html/wp-includes/plugin.php:603) in /storage/ssd3/704/7819704/public_html/wp-includes/option.php on line 820

Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd3/704/7819704/public_html/wp-includes/plugin.php:603) in /storage/ssd3/704/7819704/public_html/wp-includes/option.php on line 821

function wp_user_settings() {

    if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
        return;
    }

    if ( ! $user_id = get_current_user_id() ) {
        return;
    }

    if ( is_super_admin() && ! is_user_member_of_blog() ) {
        return;
    }

    $settings = (string) get_user_option( 'user-settings', $user_id );

    if ( isset( $_COOKIE['wp-settings-' . $user_id] ) ) {
        $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user_id] );

        // No change or both empty
        if ( $cookie == $settings )
            return;

        $last_saved = (int) get_user_option( 'user-settings-time', $user_id );
        $current = isset( $_COOKIE['wp-settings-time-' . $user_id]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user_id] ) : 0;

        // The cookie is newer than the saved value. Update the user_option and leave the cookie as-is
        if ( $current > $last_saved ) {
            update_user_option( $user_id, 'user-settings', $cookie, false );
            update_user_option( $user_id, 'user-settings-time', time() - 5, false );
            return;
        }
    }

    // The cookie is not set in the current browser or the saved value is newer.
    $secure = ( 'https' === parse_url( admin_url(), PHP_URL_SCHEME ) );
    setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
    setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
    $_COOKIE['wp-settings-' . $user_id] = $settings;
}

Alguem ?

No antepenúltimo post qual é a linha 603? E no penúltimo post qual é a linha que 820 e 821?

function wp_user_settings() {

    if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
        return;
    }

    if ( ! $user_id = get_current_user_id() ) {
        return;
    }

    if ( is_super_admin() && ! is_user_member_of_blog() ) {
        return;
    }

    $settings = (string) get_user_option( 'user-settings', $user_id );

    if ( isset( $_COOKIE['wp-settings-' . $user_id] ) ) {
        $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user_id] );

        // No change or both empty
        if ( $cookie == $settings )
            return;

        $last_saved = (int) get_user_option( 'user-settings-time', $user_id );
        $current = isset( $_COOKIE['wp-settings-time-' . $user_id]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user_id] ) : 0;

        // The cookie is newer than the saved value. Update the user_option and leave the cookie as-is
        if ( $current > $last_saved ) {
            update_user_option( $user_id, 'user-settings', $cookie, false );
            update_user_option( $user_id, 'user-settings-time', time() - 5, false );
            return;
        }
    }

    // The cookie is not set in the current browser or the saved value is newer.
    $secure = ( 'https' === parse_url( admin_url(), PHP_URL_SCHEME ) );
    setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
    setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
    $_COOKIE['wp-settings-' . $user_id] = $settings;
}

as linhas 820 e 821 são essas funçoes finais ''setcookie''

Verifica se não tem nenhum plugin ou configuração do browser que possa estar barrando esses cookies.


function do_action_ref_array($tag, $args) {
    global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;

    if ( ! isset($wp_actions[$tag]) ){
        $wp_actions[$tag] = 1;
    }
    else{
        ++$wp_actions[$tag];
    }
    // Do 'all' actions first
    if ( isset($wp_filter['all']) ) {
        $wp_current_filter[] = $tag;
        $all_args = func_get_args();
        _wp_call_all_hook($all_args);
    }

    if ( !isset($wp_filter[$tag]) ) {
        if ( isset($wp_filter['all']) )
            array_pop($wp_current_filter);
        return;
    }

    if ( !isset($wp_filter['all']) ){
        $wp_current_filter[] = $tag;
    }

    // Sort
    if ( !isset( $merged_filters[ $tag ] ) ) {
        ksort($wp_filter[$tag]);
        $merged_filters[ $tag ] = true;
    }

    reset( $wp_filter[ $tag ] );

    do {
        foreach ( (array) current($wp_filter[$tag]) as $the_ ){
            if ( !is_null($the_['function']) ){
                call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
            }
        }

    } while ( next($wp_filter[$tag]) !== false );

    array_pop($wp_current_filter);
}

a linha 603 é essa onde tem a funcao "call_user_func_array"

"Verifica se não tem nenhum plugin ou configuração do browser que possa estar barrando esses cookies."

Tudo parece normal

Desculpe, que erro dá quando chama a call_user_func_array e posta por gentileza o código dela.

este é o error referente a linha 603

Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /storage/ssd3/704/7819704/public_html/wp-includes/plugin.php on line 603

Eu não sei onde encontrar o código da função, não está nesse arquivo plugin.php

As vezes debugar código parece trabalho de detetive rsrsrs. Nessa linha 603 qual é o resultado da expressão ?

$the_['function'], array_slice($args, 0, (int) $the_['accepted_args'])

ou seja o que tem dentro dos parentenses do call_user_func_array

rest_api_loadedArray 
Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /storage/ssd3/704/7819704/public_html/wp-includes/plugin.php on line 604
wp_default_stylesArray
Warning: Parameter 1 to wp_default_scripts() expected to be a reference, value given in /storage/ssd3/704/7819704/public_html/wp-includes/plugin.php on line 604
wp_default_scriptsArray

aparece isso daqui

quiser ver o site que estou testando... http://obioinformata.000webhostapp.com/

Qual versão do Wordpress está usando?

A mesma do curso

Não sei qual é a versão do curso.

4.4.2

Fui dar uma pesquisada, a causa desse erro quando é resultado de

call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
Parameter 1 to wp_default_styles() expected to be a reference

era um bug e foi consertado na versão 4.7 tenta atualizar e veja se esse erro se resolve. Fonte: https://core.trac.wordpress.org/ticket/38144#comment:2

O curso fala para não atualizar para ter os mesmos problemas, mas vou tentar.