[wp-trac] [WordPress Trac] #26111: wp_localize_script array from callback for performance

WordPress Trac noreply at wordpress.org
Sat Apr 11 22:16:34 UTC 2015


#26111: wp_localize_script array from callback for performance
-----------------------------------+-----------------------------
 Reporter:  ciantic                |       Owner:  wonderboymusic
     Type:  enhancement            |      Status:  reopened
 Priority:  low                    |   Milestone:  4.2
Component:  Script Loader          |     Version:  2.6
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:  performance
-----------------------------------+-----------------------------
Changes (by jdgrimes):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Unfortunately, this causes issues when someone is localizing a script with
 a string that just happens to also be a function name.

 Real life example, from the Access monitor plugin
 ([https://plugins.trac.wordpress.org/browser/access-monitor/tags/1.0.3
 /access-monitor.php#L161 1]):


 {{{
 wp_localize_script( 'am.functions', 'am_ajax_action',
 'am_ajax_query_tenon' );
 }}}

 `am_ajax_query_tenon` is also the name of
 [https://plugins.trac.wordpress.org/browser/access-monitor/tags/1.0.3
 /access-monitor.php#L175 the function that responds to the action]. This
 causes the Ajax requests to fail, because they are getting `null` as the
 action they should use (because that plugin doesn't return anything).

 I'm not sure if this will be a common problem, but it could really break
 things, even kill a site (we're just lucky that `die` isn't being called
 in the middle of every page load in this case).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/26111#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list