• Resolved Malae

    (@malae)


    Errors in fatal_error_handler was posted 2 years and 5 months ago by Marcus Downing (@marcusdowning)
    I think the fatal_error_handler code is incorrect.
    This registers a global error handler, with window.onerror = function.... The handler attempts to match the wording of the error, looking for deprecated jQuery functions.

    It uses msg.match(), which returns either null or an array, but the code to check for results says:
    if ( typeof erroredFunction !== 'object' || typeof erroredFunction[1] === "undefined" || -1 === jQueryFunctions.indexOf( erroredFunction[1] ) ) {
    return true;
    }

    This doesn’t work when the result is null because typeof null === "object" in JavaScript.

    and also a solution from Benjamin Danon (@bndn)
    This error is reported on Github too.
    We have to add a condition to the line 289 of wp-content/plugins/enable-jquery-migrate-helper/class-jquery-migrate-helper.php to fix it:

    if ( erroredFunction === null || typeof erroredFunction !== 'object' || typeof erroredFunction[1] === "undefined" || -1 === jQueryFunctions.indexOf( erroredFunction[1] ) ) {

    It seems to work, but does not appear to have been implemented , or answered.
    I am still getting the error in the Firefox Console:
    Uncaught TypeError: erroredFunction is null
    Am I missing something?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi there!

    It seems to work, but does not appear to have been implemented , or answered.

    I believe you’re referring to this thread, right?

    I see the issue that you linked yourself is closed as solved. Can you confirm when you started having this error? Also, can you confirm your Enable jQuery Migrate Helper plugin version?

    Thread Starter Malae

    (@malae)

    Hello Felipe,

    Thank you for your reply. Yes, that is the thread to which that I was referring. It has notations: Status: not resolved. The topic ‘Errors in fatal_error_handler’  is closed to new replies.

    I presumably have always had this error, but had some other issues on a site and wanted to clean up as many errors as possible that were showing in the console. It is showing on all sites using the plugin and on other browsers:  Chrome and Edge.

     I have WordPress  6.2.2 and Enable jQuery Migrate Helper version 1.3.0 with PHP 8.0.28.

    If I open class-jquery-migrate-helper.php line 289 in this version:
    if ( typeof erroredFunction !== 'object' || typeof erroredFunction[1] === "undefined" || -1 === jQueryFunctions.indexOf( erroredFunction[1] ) ) {

    This appears not to have changed from that shown in the above referenced thread more than two years ago.

    Oh, I see your point. Thank you for clarifying that!

    It looks like the version from GitHub wasn’t moved to www.remarpro.com. I’ll contact the appropriate team to move this update and release a new version.

    For now, you can update this from GitHub directly — this project doesn’t seem to have dependencies, so you can try downloading from trunk: https://github.com/WordPress/jquery-migrate-helper/archive/refs/heads/trunk.zip

    Thread Starter Malae

    (@malae)

    Thanks, I had applied the suggested fix on some sites, but using the file from link will make it easier. I presume at some point the WordPress repository will be updated.

    Moderator jordesign

    (@jordesign)

    Hey @malae – yes that’s correct. The developer has been notified now and I’d expect an update to be rolled out ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Errors in fatal_error_handler’ is closed to new replies.