• Resolved lestadt

    (@lestadt)


    Hello, today I looked at the error_log of one of my sites and I found this:

    [27-Sep-2018 10:42:38 UTC] PHP Warning: Invalid argument supplied for foreach() in /public_html/wp-content/plugins/404-solution/includes/SpellChecker.php on line 358

    [28-Sep-2018 07:02:20 UTC] WordPress database error Duplicate entry ” for key ‘lkup_value’ for query insert into wp_abj404_lookup (lkup_value) values (”) made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), do_action(‘template_redirect’), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, ABJ_404_Solution_WordPress_Connector::process404, ABJ_404_Solution_DataAccess->logRedirectHit, ABJ_404_Solution_DataAccess->insertLookupValueAndGetID, ABJ_404_Solution_DataAccess::queryAndGetResults

    [28-Sep-2018 07:02:20 UTC] ABJ-404-SOLUTION (ERROR): Ugh. SQL error: Duplicate entry '' for key 'lkup_value'

    Apparently everything works fine, but these warnings make me wonder what would be happening, I put this for informational purposes. That could be happening?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Aaron

    (@aaron13100)

    Hey lestadt,

    Indeed the two messages don’t change the functionality of the plugin. One of your sites emailed me the error message already, so thanks for your participation in that.

    There are a number of non-essential error messages that are emailed to me every once in a while that I haven’t gotten around to correcting and these are two examples.

    For example the “Invalid argument supplied for foreach()” seems to result from an array being expected when there isn’t one. The fix will be using an empty array when there are no results from a particular query instead of not using an array. The results of the function will be the same. Basically the code is doing something like this:

    $query_Results = get_all_rows_that_match_xxx();
    look through each result in $query_Results for some specific data;
    return any specific data found;

    Since the query results are empty there is no data to find and the function returns an empty array, which is what it is supposed to return because no data was found.

    Since they don’t change the functionality in any way my practice has been to just leave these kind of error messages there until I get bored enough to fix them, or until I get tired of getting automated emails about them.

    Plugin Author Aaron

    (@aaron13100)

    I made changes to avoid the two errors you mentioned and uploaded version 2.10.1. There will still be other messages probably. Checking the “Help the developer by sending error logs” checkbox on the options page is useful because it emails me the debug log whenever there’s an error. Let me know if there’s anything else.

    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error and PHP Warning’ is closed to new replies.