Errors in fatal_error_handler
-
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, withwindow.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?
The topic ‘Errors in fatal_error_handler’ is closed to new replies.