Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Debug.log error – undefined index/offset
- This topic has 3 replies, 2 voices, and was last updated 7 years, 7 months ago by
Ernest Marcinko.
-
AuthorPosts
-
November 3, 2018 at 10:12 pm #19736
custompczone
ParticipantI’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 52Here’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?
November 4, 2018 at 2:15 pm #19741Ernest Marcinko
KeymasterHi!
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.
November 5, 2018 at 2:52 pm #19772custompczone
ParticipantThank you Ernest!
November 5, 2018 at 2:55 pm #19775Ernest Marcinko
KeymasterYou cannot access this content.
-
AuthorPosts
- The topic ‘Debug.log error – undefined index/offset’ is closed to new replies.