Last modified: 2011-02-14 00:55:39 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T27571, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 25571 - encodeJsVar incorrectly handling floats
encodeJsVar incorrectly handling floats
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.17.x
All All
: Normal normal (vote)
: ---
Assigned To: Michael Dale
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-10-18 22:15 UTC by Jeroen De Dauw
Modified: 2011-02-14 00:55 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Jeroen De Dauw 2010-10-18 22:15:52 UTC
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?
Comment 1 Brion Vibber 2011-02-14 00:55:39 UTC
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).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links