Page MenuHomePhabricator

encodeJsVar incorrectly handling floats
Closed, ResolvedPublic

Description

Xml::encodeJsVar puts quotes around floats. Can be fixed by changing

<pre>} elseif ( is_int( $value ) ) {</pre>

into

<pre>} elseif ( is_int( $value ) || is_float( $value ) ) {</pre>

Any reason not to make this change?


Version: 1.17.x
Severity: normal

Details

Reference
bz25571

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:22 PM
bzimport set Reference to bz25571.

Looks good... I also threw in a strval() on the return value just for good measure (shouldn't make a difference in usage since appending is all that gets done with these).

Fixed in r82099; also added phpunit test cases for int, float, and strings that appear like int and float (which correctly do pass through as strings).