[wp-trac] [WordPress Trac] #25280: wp_localize_script unexpectedly converts numbers to strings

WordPress Trac noreply at wordpress.org
Tue Aug 5 00:36:43 UTC 2014


#25280: wp_localize_script unexpectedly converts numbers to strings
----------------------------------------------+----------------------------
 Reporter:  adamsilverstein                   |       Owner:
     Type:  enhancement                       |      Status:  new
 Priority:  normal                            |   Milestone:  Future
Component:  I18N                              |  Release
 Severity:  normal                            |     Version:  3.2
 Keywords:  has-patch dev-feedback 4.1-early  |  Resolution:
                                              |     Focuses:  javascript
----------------------------------------------+----------------------------

Comment (by adamsilverstein):

 Replying to [comment:18 helen]:
 > Given concerns about plugin breakage, punting and marking as early. Can
 possibly bring back with discussion, though. Sorry it didn't get attention
 earlier.

 Agree this needs to go in early in a cycle to avoid potential conflicts
 and give developers time to adapt.

 I don't **think** we'll see many issues, since mostly developers are
 forced to 'parseInt' numbers back to numbers when we expect them and they
 are passed as strings instead; if we pass actual ints, 'parseInt' should
 still work fine. Booleans might be more of an issue, still should be easy
 to fix.

 If we want to avoid any chance of a conflict, we could add a new option to
 the function to turn on this new behavior (yuck) or add a new function
 entirely (ugh).

 Once we do get this in, we should go thru every place we added parseInt in
 core and take them out.

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


More information about the wp-trac mailing list