[wp-trac] [WordPress Trac] #56425: wp_localize_script assign to const and freeze instead of var to avoid reassignments

WordPress Trac noreply at wordpress.org
Tue Aug 23 23:59:48 UTC 2022


#56425: wp_localize_script assign to const and freeze instead of var to avoid
reassignments
-------------------------------------------------+-------------------------
 Reporter:  malthert                             |      Owner:  (none)
     Type:  enhancement                          |     Status:  new
 Priority:  normal                               |  Milestone:  Awaiting
                                                 |  Review
Component:  Script Loader                        |    Version:  trunk
 Severity:  normal                               |   Keywords:
  Focuses:  javascript, performance, coding-     |
  standards                                      |
-------------------------------------------------+-------------------------
 wp_localize_script adds elements as "var".

 To avoid accidental, silent overwrites by other plugins or malicious code,
 it would be better if we used a const and freeze the object, to disable
 reassignments.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56425>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list