Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#49292 closed defect (bug) (worksforme)

Fix javascript error caused by incorrectly escaped url

Reported by: juliastri's profile juliastri Owned by: juliastri's profile juliastri
Milestone: Priority: normal
Severity: normal Version: 5.3.2
Component: Script Loader Keywords: reporter-feedback close
Focuses: javascript Cc:

Description

This error message appears in the console on all pages in wp-admin:

Uncaught SyntaxError: missing ) after argument list

It is caused by this line, as seen in the browser console:

<script>
( "fetch" in window ) || document.write( "<script src="http://wv5.local.com/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js?ver=3.0.0"></scr" + "ipt>" );( document.contains ) || document.write( "<script src="http://wv5.local.com/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js?ver=3.26.0-0"></scr" + "ipt>" );( window.FormData && window.FormData.prototype.keys ) || document.write( "<script src="http://wv5.local.com/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js?ver=3.0.12"></scr" + "ipt>" );( Element.prototype.matches && Element.prototype.closest ) || document.write( "<script src="http://wv5.local.com/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js?ver=2.0.2"></scr" + "ipt>" );
</script>

Attachments (3)

console.PNG (10.6 KB) - added by juliastri 5 years ago.
The error message
sources.PNG (22.3 KB) - added by juliastri 5 years ago.
The code that appears in sources
49292.diff (642 bytes) - added by juliastri 5 years ago.
patch file attached

Download all attachments as: .zip

Change History (7)

@juliastri
5 years ago

The error message

@juliastri
5 years ago

The code that appears in sources

#1 in reply to: ↑ description @juliastri
5 years ago

Replying to juliastri:

This error message appears in the console on all pages in wp-admin:

Uncaught SyntaxError: missing ) after argument list

It is caused by this line, as seen in the browser console:

<script>
( "fetch" in window ) || document.write( "<script src="http://wv5.local.com/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js?ver=3.0.0"></scr" + "ipt>" );( document.contains ) || document.write( "<script src="http://wv5.local.com/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js?ver=3.26.0-0"></scr" + "ipt>" );( window.FormData && window.FormData.prototype.keys ) || document.write( "<script src="http://wv5.local.com/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js?ver=3.0.12"></scr" + "ipt>" );( Element.prototype.matches && Element.prototype.closest ) || document.write( "<script src="http://wv5.local.com/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js?ver=2.0.2"></scr" + "ipt>" );
</script>

Note:
I know how to fix it.
The problem is in wp-includes/script-loader.php file where the escaped string inside $polyfill is not rendered correctly.

@juliastri
5 years ago

patch file attached

#2 @ocean90
5 years ago

  • Component changed from General to Script Loader
  • Keywords reporter-feedback added

Hello @juliastri, welcome to WordPress Trac!

Thanks for your report. Are you using a custom plugin or something else which modifies the HTML output? Because by default, as you can see in your patch, the string starts with a single quote mark (') and not a double quote mark (") which shouldn't cause this issue.

#3 @desrosj
5 years ago

  • Keywords close added

I'm also unable to reproduce this.

@juliastri are you using version 5.3.2? trunk?

Going to add close pending more feedback.

#4 @hellofromTonya
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from assigned to closed

Hello @juliastri,

I'm closing this ticket as it's been a year since feedback was requested. However, if this problem persists today, please feel free to reopen and provide us with more information, i.e. to help us further investigate.

Note: See TracTickets for help on using tickets.