• Resolved davidgimenez

    (@davidgimenez)


    Hello, I had to update my PHP version to 8 and I get these types of errors a lot and my theme is storefront.

    PHP Warning: Attempt to read property “post_type” on null in /home//public_html/wp-content/plugins/header-footer-elementor/inc/lib/target-rule/class-astra-target-rules-fields.php on line 1334 PHP Warning: Attempt to read property “ID” on null in /home//public_html/wp-content/plugins/header-footer-elementor/inc/lib/target-rule/class-astra-target-rules-fields.php on line 1335

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter davidgimenez

    (@davidgimenez)

    Update this code:

    /* Entire Website */ $meta_args = “pm.meta_value LIKE ‘%\”basic-global\”%'”; switch ( $current_page_type ) { case ‘is_404’: $meta_args .= ” OR pm.meta_value LIKE ‘%\”special-404\”%'”; break; case ‘is_search’: $meta_args .= ” OR pm.meta_value LIKE ‘%\”special-search\”%'”; break; case ‘is_archive’: case ‘is_tax’: case ‘is_date’: case ‘is_author’: $meta_args .= ” OR pm.meta_value LIKE ‘%\”basic-archives\”%'”; $meta_args .= ” OR pm.meta_value LIKE ‘%\”{$current_post_type}|all|archive\”%'”; if ( ‘is_tax’ == $current_page_type && ( is_category() || is_tag() || is_tax() ) ) { if ( is_object( $q_obj ) ) { $meta_args .= ” OR pm.meta_value LIKE ‘%\”{$current_post_type}|all|taxarchive|{$q_obj->taxonomy}\”%'”; $meta_args .= ” OR pm.meta_value LIKE ‘%\”tax-{$q_obj->term_id}\”%'”; } } elseif ( ‘is_date’ == $current_page_type ) { $meta_args .= ” OR pm.meta_value LIKE ‘%\”special-date\”%'”; } elseif ( ‘is_author’ == $current_page_type ) { $meta_args .= ” OR pm.meta_value LIKE ‘%\”special-author\”%'”; } break; case ‘is_home’: $meta_args .= ” OR pm.meta_value LIKE ‘%\”special-blog\”%'”; break; case ‘is_front_page’: $current_post_id = $current_id; $meta_args .= ” OR pm.meta_value LIKE ‘%\”special-front\”%'”; $meta_args .= ” OR pm.meta_value LIKE ‘%\”{$current_post_type}|all\”%'”; $meta_args .= ” OR pm.meta_value LIKE ‘%\”post-{$current_id}\”%'”; break; case ‘is_singular’: $current_post_id = $current_id; $meta_args .= ” OR pm.meta_value LIKE ‘%\”basic-singulars\”%'”; $meta_args .= ” OR pm.meta_value LIKE ‘%\”{$current_post_type}|all\”%'”; $meta_args .= ” OR pm.meta_value LIKE ‘%\”post-{$current_id}\”%'”; $taxonomies = get_object_taxonomies( $q_obj->post_type ); $terms = wp_get_post_terms( $q_obj->ID, $taxonomies ); foreach ( $terms as $key => $term ) { $meta_args .= ” OR pm.meta_value LIKE ‘%\”tax-{$term->term_id}-single-{$term->taxonomy}\”%'”; } break; case ‘is_woo_shop_page’: $meta_args .= ” OR pm.meta_value LIKE ‘%\”special-woo-shop\”%'”; break; case ”: $current_post_id = $current_id; break; }

    To this code that I corrected:

    /* Entire Website */
    $meta_args = “pm.meta_value LIKE ‘%\”basic-global\”%'”;

    switch ($current_page_type) {
    case ‘is_404’:
    $meta_args .= ” OR pm.meta_value LIKE ‘%\”special-404\”%'”;
    break;
    case ‘is_search’:
    $meta_args .= ” OR pm.meta_value LIKE ‘%\”special-search\”%'”;
    break;
    case ‘is_archive’:
    case ‘is_tax’:
    case ‘is_date’:
    case ‘is_author’:
    $meta_args .= ” OR pm.meta_value LIKE ‘%\”basic-archives\”%'”;
    $meta_args .= ” OR pm.meta_value LIKE ‘%\”{$current_post_type}|all|archive\”%'”;

        if ('is_tax' == $current_page_type && (is_category() || is_tag() || is_tax())) {
            if (is_object($q_obj)) {
                $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all|taxarchive|{$q_obj->taxonomy}\"%'";
                $meta_args .= " OR pm.meta_value LIKE '%\"tax-{$q_obj->term_id}\"%'";
            }
        } elseif ('is_date' == $current_page_type) {
            $meta_args .= " OR pm.meta_value LIKE '%\"special-date\"%'";
        } elseif ('is_author' == $current_page_type) {
            $meta_args .= " OR pm.meta_value LIKE '%\"special-author\"%'";
        }
        break;
    case 'is_home':
        $meta_args .= " OR pm.meta_value LIKE '%\"special-blog\"%'";
        break;
    case 'is_front_page':
        $current_post_id = $current_id;
        $meta_args .= " OR pm.meta_value LIKE '%\"special-front\"%'";
        $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all\"%'";
        $meta_args .= " OR pm.meta_value LIKE '%\"post-{$current_id}\"%'";
        break;
    case 'is_singular':
        $current_post_id = $current_id;
        $meta_args .= " OR pm.meta_value LIKE '%\"basic-singulars\"%'";
        $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all\"%'";
        $meta_args .= " OR pm.meta_value LIKE '%\"post-{$current_id}\"%'";
    
        if (is_object($q_obj)) {
            $taxonomies = get_object_taxonomies($q_obj->post_type);
            $terms = wp_get_post_terms($q_obj->ID, $taxonomies);
    
            foreach ($terms as $key => $term) {
                $meta_args .= " OR pm.meta_value LIKE '%\"tax-{$term->term_id}-single-{$term->taxonomy}\"%'";
            }
        }
    
        break;
    case 'is_woo_shop_page':
        $meta_args .= " OR pm.meta_value LIKE '%\"special-woo-shop\"%'";
        break;
    case '':
        $current_post_id = $current_id;
        break;

    }

    Plugin Support Herman Asrori (BSF)

    (@bsfherman)

    Hi @davidgimenez,

    Could you please share with us the exact steps to replicate this case?

    I look forward to hearing from you.

    Kind regards,
    Herman ??

    Thread Starter davidgimenez

    (@davidgimenez)

    There are no steps to explain, activate version 8.3 of PHP and in the error log I could see those errors. If I change version 7.4, I no longer get those errors in the log. and I solved it with the code that I gave you, it seems that you have an error in the code that is incompatible with versions 8 of PHP

    Plugin Support Herman Asrori (BSF)

    (@bsfherman)

    That’s it, @davidgimenez!

    This plugin is not yet fully compatible with PHP 8.3. Even this plugin is still not fully compatible with PHP 8.2. It will, in the next release.

    So, please use PHP 8.2 at max or even the lower one, like PHP 8.1 to make sure this plugin runs smoothly.

    Kind regards,
    Herman ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘php 8 errors’ is closed to new replies.