This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Debug.log error – undefined index/offset

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Debug.log error – undefined index/offset

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #19736
    custompczonecustompczone
    Participant

    I’m seeing this error occur in debug.log about 20-40 times per hour:

    [03-Nov-2018 18:14:02 UTC] PHP Notice: Undefined index: priority in /var/www/html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 1526
    [03-Nov-2018 18:14:02 UTC] PHP Notice: Undefined index: priority in /var/www/html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 1526
    [03-Nov-2018 18:18:16 UTC] PHP Notice: Undefined offset: -1 in /var/www/html/wp-content/plugins/ajax-search-pro/includes/views/asp.shortcode.categories_terms.php on line 52
    [03-Nov-2018 18:23:40 UTC] PHP Notice: Undefined offset: -1 in /var/www/html/wp-content/plugins/ajax-search-pro/includes/views/asp.shortcode.categories_terms.php on line 52

    Here’s what I see at line 51-68
    [code]
    51 // Need all terms
    52 if ( count($terms) == 1 && $terms[-1]["id"] == -1 ) {
    53 $_needed_all = true;
    54 $_needed_terms_full = get_terms($taxonomy, array(
    55 ‘taxonomy’=> $taxonomy,
    56 ‘orderby’ => $term_ordering[0],
    57 ‘order’ => $term_ordering[1],
    58 ‘hide_empty’ => 0,
    59 ‘exclude’ => isset($terms[-1]["ex_ids"]) ? $terms[-1]["ex_ids"] : array()
    60 ));
    61 } else {
    62 $_needed_all = false;
    63 $_needed_terms_full = get_terms($taxonomy, array(
    64 ‘taxonomy’=> $taxonomy,
    65 ‘orderby’ => ‘include’,
    66 ‘order’ => ‘ASC’,
    67 ‘include’ => $term_ids,
    68 ‘hide_empty’ => 0
    [/code]

    Any idea how I can fix this?

    #19741
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    Make sure to open the search options on the back-end and save them, so the data is consistent. If that does not help, then change line 52 (in the code you linked) from this:

    [code]if ( count($terms) == 1 && $terms[-1][‘id’] == -1 ) {[/code]

    to this:

    [code]if ( count($terms) == 1 && isset($terms[-1], $terms[-1][‘id’]) && $terms[-1][‘id’] == -1 ) {[/code]

    That will do the trick!

    Thank you for letting us know, I will make sure to include this fix in the upcoming release.

    #19772
    custompczonecustompczone
    Participant

    Thank you Ernest!

    #19775
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Debug.log error – undefined index/offset’ is closed to new replies.